Hello! I am new to c++ and I am trying to use a do-while loop with strictly if-else nested statement. But I am encountering an issue where my loop does not break after pressing Cntrl Z which is my condition. Below is my coding, I hope someone can help me!
First, that code is C, it just so happens to also compile with C++. Just needed to clarify that.
If you want to actually learn C++, let us know and we can direct you to better places (like this site's tutorial).
scanf is not going to be put EOF in the grade variable, that's not how it works. It returns EOF if it reads EOF from the input. So you need to check the return value of scanf. https://www.csd.uoc.gr/~math106/slides/scanf_Tutorial.pdf
Also, each condition in an if-statement must be an independent clause.
You need to do elseif (grade == 'B' || grade == 'b') etc.
Oops! So sorry, didn't know about that, thank you for clarifying. So what should I use so that EOF can be read? getchar()? Thanks for the help, really appreciate it