Uso del operador :?

Published by CppPythonDude in

Existe un operador ?: en C++ y su forma básica es (condition) ? (something1) : (something2).

Para ilustrarlo:

if (condition)
  something1;
else
  something2;

Escribe una función que use el operador ?: para devolver "yeah" si b es true, y "nope" en caso contrario.

Ejemplos

yeahNope(true) ➞ "yeah"

yeahNope(false) ➞ "nope"

Notas

N/A