conditional Operator '?' : Operator « Language « C++
- C++
- Language
- Operator
conditional Operator '?'

#include <iostream>
using namespace std;
int main(void)
{
int num;
cout << "Enter a whole number: ";
cin >> num;
cout << "The number is " << ( num % 2 == 0 ? "even" :
"odd") << endl;
return 0;
}
Related examples in the same category