c++ - program exits automatically -
i have created simple .exe file. when run it, closes automatically instead of saying "press key exit".
this program:
#include <iostream> #include <string> using namespace std; int main() { string answer, yes = "yes"; cout << "is lucy top lass ? enter yes or no" << endl; cin >> answer; if (answer == yes) { cout << "correctomundo" << endl; } else { cout << " blasphemy ! " << endl; } return 0; }
how make ask user press key before exiting?
also there way can change says else instead of "press key exit"?
try putting system("pause");
before return 0;
Comments
Post a Comment