So, I was making a simple quiz program for kids in C++ (I am really a beginner to programming). What I wanted to do was require the user to press Enter after the first question and only upon pressing enter, the second question is visible. But due to some reasons, C++ doesn't waits for the user to enter an output in the cin statement and automatically prints the next question.
Here's the code:
cout << "Q1. Which of these languages is not used to make Computer Software?" << endl;
cout << "a. Python" << endl;
cout << "b. Java" << endl;
cout << "c. C++" << endl;
cout << "d. HTML" << endl;
cout << "" << endl;
cin >> ans;
cout << "" << endl;
cout << "Press Enter to Continue";
cin.ignore();