C++比较运算符
目录
1、==、!=、>、<、>=、<=
2、代码以及结果
#include<iostream>
using namespace std;
int main() {
//比较运算符
// ==
int a = 10;
int b = 20;
cout << (a == b) << endl;
// !=
cout << (a != b) << endl;
//>
cout << (a > b) << endl;
//<
cout << (a < b) << endl;
//>=
cout << (a >=b) << endl;
//<=
cout << (a <=b) << endl;
system("pause");
return 0;
}
0
1
0
1
0
1
请按任意键继续. . .