123456789101112131415 |
- /* There is a ?: operator in C++ and it's basic form is
- (condition) ? (something1) : (something2).
- To illustrate:
- if (condition)
- something1;
- else
- something2;
- Write a function that uses the ?: operator to
- return "yeah" if the condition is true, and "nope" otherwise.
- */
- std::string yeahNope(bool b) {
- return b ? "yeah" : "nope";
- }
|