fig11_10.cpp

来自「经典vc教程的例子程序」· C++ 代码 · 共 20 行

CPP
20
字号
// Fig. 11.10: fig11_10.cpp 
// Avoiding a precedence problem between the stream-insertion 
// operator and the conditional operator.
// Need parentheses around the conditional expression.
#include <iostream.h>

int main()
{
   int x, y;

   cout << "Enter two integers: ";
   cin >> x >> y;
   cout << x << ( x == y ? " is" : " is not" ) 
        << " equal to " << y << endl;

   return 0;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?