C++ separate if | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

C++ separate if

So I’m wondering how to seperate if statements so i could input something like Hi then input something different and get a different answer

8th Apr 2019, 1:58 AM
Feline_CODEZ
Feline_CODEZ - avatar
2 Antworten
0
Separate the if with an else-if statement and check if another condition is met. if (!str.compare("Hi")) std::cout << "Hello\n"; else if (!str.compare("Hello")) std::cout << "Hi\n"; else std::cout << "Greetings\n";
8th Apr 2019, 2:28 AM
Cluck'n'Coder
Cluck'n'Coder - avatar
0
ok thanks
9th Apr 2019, 2:09 PM
Feline_CODEZ
Feline_CODEZ - avatar