mardi 18 avril 2017

What does this code mean (c++) ? years = y >= 18 ? y : 18; [duplicate]

This question already has an answer here:

I was looking in my friends notes and I saw this code

 years = y >= 18 ? y : 18;

all what I know about the ? in c++ it's act like if statement

can I have some help with it ?

like how to write it with if

Aucun commentaire:

Enregistrer un commentaire