C++ examples for Operator:Conditional Operator
Using the Conditional Operator to Do Comparisons
#include <iostream> #include <string> using namespace std; int main()// w w w. j a va2 s. co m { int first = 10; int second = 20; string result; result = first == second ? "equal" : "not equal"; cout << result << endl; return 0; }