记C++中发现的隐式转换问题

 1 #include <iostream>
 2 #include <string>
 3 using std::cin;
 4 using std::cout;
 5 using std::endl;
 6 using std::string;
 7 int main()
 8 {
 9     unsigned int a;
10     int b = -1;
11     while (cin >> a)
12     {
13         if (a > b)
14         {
15             cout << "a > b" << endl;
16         }
17         else if (a < b)
18         {
19             cout << "a < b" << endl;
20         }
21         else
22         {
23             cout << "a == b" << endl;
24         }
25         
26     }
27     return 0;
28 }

 未完待续。

猜你喜欢

转载自www.cnblogs.com/Will-zyq/p/12359562.html