samedi 8 juillet 2017

C++ "do nothing" command as a part of ? command

What's the standard line to add to ? command in order to do nothing if the condition is not met?

Example:

int main() {
int a
cin >> a;
a> 10 ? a=5 : (DO NOTHING);
cout << a << endl;
...

Just putting the name of the paramter there seems to do the trick, but I am wondering if there is a generally accepted way. `

Aucun commentaire:

Enregistrer un commentaire