use of WHILE loop to read the grades
Hi :)
I was trying to learn the use of WHILE loop. Given below is the simple program I tried to write. The first problem is even when I enter the Roll No. to be "10000" the program doesn't terminate. Secondly, what suggestion(s) or advice(s) do you have for me to improve the program, or learning these WHILE, FOR, DO loops? Please let me know. Thanks a lot.
Code:
// use of WHILE loop to read the grades
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int RN;
float M;
while(RN != 10000)
{
cout << "Enter the roll no.: ";
cin >> RN;
cout << "Enter the marks: ";
cin >> M;
if ( M > 80 )
cout << "A Grade" << endl;
else if ( M > 70 )
cout << "B Grade" << endl;
else if ( M > 60 )
cout << "C Grade" << endl;
else if ( M < 60 )
cout << "F Grade" << endl;
}
system("pause");
}