Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- int a{ 42 };
- int b{ 10 };
- int c{ 15 };
- //std::cout << "Enter two numbers to find maximum from\n";
- //std::cin >> a;
- //std::cin >> b;
- int res{ 0 };
- //if ( a > b )
- //{
- // res = a;
- //}
- //if ( b > a)
- //{
- // res = b;
- //}
- //if (a < b )
- //{
- // res = b;
- //}
- //else
- //{
- // res = a;
- //}
- //(a > b) ? (res = a) : (res = b);
- // res = ((a > b) ? (a) : (b));
- //res = a > b ? a > c ? a : c : b > c ? b : c;
- res = a > b ? a : b;
- res = res > c ? res : c;
- //((conditionalExpr) ? (exprIfTrue) : (exprIfFalse));
- std::cout << "res = " << res << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement