fig01_14.cpp
来自「经典vc教程的例子程序」· C++ 代码 · 共 36 行
CPP
36 行
// Fig. 1.14: fig1_14.cpp
// Using if statements, relational
// operators, and equality operators
#include <iostream.h>
int main()
{
int num1, num2;
cout << "Enter two integers, and I will tell you\n"
<< "the relationships they satisfy: ";
cin >> num1 >> num2; // read two integers
if ( num1 == num2 )
cout << num1 << " is equal to " << num2 << endl;
if ( num1 != num2 )
cout << num1 << " is not equal to " << num2 << endl;
if ( num1 < num2 )
cout << num1 << " is less than " << num2 << endl;
if ( num1 > num2 )
cout << num1 << " is greater than " << num2 << endl;
if ( num1 <= num2 )
cout << num1 << " is less than or equal to "
<< num2 << endl;
if ( num1 >= num2 )
cout << num1 << " is greater than or equal to "
<< num2 << endl;
return 0; // indicate that program ended successfully
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?