mercredi 20 octobre 2021

is it possible for boolean operator to print statements in c++? [closed]

I am learning C++ and had this query... Can we use bool and if-else statements to print statements? here is what I was trying to do... ''' string input1;

string input2;

cout<<"What would you like to have on plate 1"<<endl;
cin>>input1;
cout<<"What would you like to have on plate 2"<<endl;
cin>>input2;
bool b = input1 == input2;
if ((b = true)) {
    cout<<"both orders are the same "<<endl;
} else {
    cout<<"ohk so you will have "<<input1<<"and "<<input2<<"."<<endl;
}

'''

Aucun commentaire:

Enregistrer un commentaire