ex3_04.cpp

来自「Beginning Visual C++ 6源码。Wrox。」· C++ 代码 · 共 22 行

CPP
22
字号
// EX3_04.CPP
// The conditional operator selecting output
#include <iostream>

using namespace std;

int main()
{
   int nCakes = 1;           // Count of number of cakes

   cout << endl
        << "We have " << nCakes << " cake" << ((nCakes>1) ? "s." : ".")
        << endl;

   ++nCakes;

   cout << endl
        << "We have " << nCakes << " cake" << ((nCakes>1) ? "s." : ".")
        << endl;
   return 0;
}

⌨️ 快捷键说明

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