I'm fairly new to C++ so please bear with me. I've tried cin.get() cin.clear() etc but nothing works so far. I pressed ctrl+Z to end the while loop. Don't know if it has anything to do with it.
Thank you guys!
cout<<"Please enter student's name"<<endl;
cout<<"Please enter your midterm and final exam grades"<<endl;
cout<<"Please enter all your HW grandes below"<<endl;
double x; //a variable to read as one HW grade
cout<<"Your final semester grade is "<<setprecision(3)<<0.2*midterm+0.4*final+0.4*sum/count<<setprecision(prec)<<endl;
cout<<"enter any number to exit"<<endl;
Sorry I didn't make my question very clear. i didn't get an error. I don't know how to prevent the console from closing down after execution. The console closes down right after I entered ctrl+Z+enter (to satisfy the 'false' condition for the while loop i think? ) so I didn't even get a chance to see if the last output is correct.
I'm tempted to report this entire thread. "Console Closing Down" is literally the title of the second sticky thread on this board. It answers this exact question with discussion of methods that work and why some methods are better than others.
@ OP: When you ping a remote computer or a website, does ping.exe try to keep the console open for you so that you can read the result? How about calcs.exe? How about any of the console tools in SysInternals? Why do you think that none of these console applications bother to do what you are trying to do here? I'm being serious here.