+ 1

How to write a program in C++ which continually asks for users input and terminates when typing "Exit"

C++

21st Oct 2020, 10:26 AM
Miyamooo ♡
Miyamooo ♡ - avatar
3 Respuestas
+ 7
U can write that program by learning syntaxes of c++ along with some practise. If u want us to help, pls post ur try(code):)
21st Oct 2020, 11:13 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 2
//it is not terminating :( it must terminate using exit or EXIT or Exit #include <iostream> using namespace std; int main () { string stringVariable; for (;;) { do { cout <<"Enter a random text: "; cin >> stringVariable ; cout << stringVariable << endl ; } while(stringVariable != "exit" || "EXIT" || "Exit"); if (stringVariable == "exit" || "EXIT" || "Exit" ); break; } return 0; }
21st Oct 2020, 2:16 PM
Miyamooo ♡
Miyamooo ♡ - avatar
+ 1
Thanks a lot everyone, great help! :)))))))
22nd Oct 2020, 1:05 AM
Miyamooo ♡
Miyamooo ♡ - avatar