Answers for "ternary operators in cpp"

C++
0

c++ ternery operator

int time = 20;
string result = (time < 18) ? "Good day." : "Good evening.";
cout << result;
Posted by: Guest on October-27-2021
0

c++ ternary statement

x = condition ? expression1 : expression2

// Example:
double x = 1 > 0 ? 10 : 20; // put any value
Posted by: Guest on December-09-2020

Browse Popular Code Answers by Language