dimanche 10 mai 2020

are there ways to do if statements inside a cout line?

Im starting to learn C++, and something useful from my main language lua, is the ability to say:

print(true/false and 1 or 0)

, 1 or 0 being anything but it seems in c++ it doesnt work the same way?

what I tried for C++ was

cout << (score == 0) and "Valid";

but only a true if check seems to work

if (score == 0) {
        cout << "Valid";
} else{
        cout << "A";

};

Aucun commentaire:

Enregistrer un commentaire