how to print text at the same time as a cin function but below it

#include <iostream>
#include <limits>
using namespace std;
#pragma once
class KeepRunning {
public:
~KeepRunning() {

system("pause");//press enter to close program
}
};

int main()
{
KeepRunning kr;
int score;// the user entes their percentage, this is the variable

loop:
cout << "Enter your percentage on the test\nPercentage:";
cin >> score; // enter your score here

// i want to have some text here that says:<press enter to continue> and have it print at the same time as "cout << "Enter your percentage on the test\n";" and "cin >> score;" How do i do this?

//if outcomes
if (score == 100){
cout<<"Excellent, you got a perfect score/A*!\n";
}
else if (score>=90 && score<100){
cout<<"Well done, You got an A.\n";
}
else if (score>=80 && score<90){
cout<<"Good, you got a B.\n";
}
else if (score>=70 && score<80){
cout<<"Okay, you got a C, you just passed.\n";
}
else if (score>=60 && score<70){
cout<<"Not good, you got a D, try harder next time.\n";
}
else if (score>=0 && score<60) {
cout<<"Awful, you got a F, Go home and do more revision!!!\n";
}
else if (score>100) {
cout<<"You can't get more than 100%!\n";
goto loop;//goes back to entering your score
}
else if (score<0) {
cout<<"You can't get less than 0%!\n";
goto loop;//goes back to entering your score
}
return 0;
}
Last edited on
closed account (zb0S216C)
I don't understand what you mean. std::system( "PAUSE" ) prints "press any key to continue..." by default, so writing "press enter to continue" would be redundant.

Also, don't use Label: ... goto. It's a deprecated feature.

Wazzak
Topic archived. No new replies allowed.