I have two questions. The first is that is there a way to make the user be able to shut down the program at anytime by typing something in a certain string?
Or does this work?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include <string>
int main(){
string a;
while(a=="SHUT DOWN")
{
cout<<"Shutting down"<<endl;
return 0}
cout<<"Asking the user for some input. Type in 'SHUT DOWN' to stop"<<endl;
cin<<a
system("pause")
return 0;
}
My 2nd question: is there a way to loop to the beginning of the program once the program is finished? The only way to get out would be to type in 'SHUT DOWN' in the way I showed above.