"I want to help me to know where is the error in my programming"
Q:
Write a C++ program that reads several marks. For each of these marks, your program should determine and display the correspondent grade. The number of marks entered is not known. Use a sentinel value to stop. The grade will be determined by the following formula:
If the mark is greater than or equal 90, the grade is A. If the mark is greater than or equal 80 and less than 90, the grade is B. If the mark is greater than or equal 70 and less than 80, the grade is C. If the mark is greater than or equal 60 and less than 70, the grade is D. If the mark is less than 60, the grade is F
try answer:
#include <iostream>
using namespace std;
int main ()
{
int mark;
char grade;
cout << "Enter a mark:";
cin >> mark;
cout <<endl;
well, first of all, there is no need of the while loop, so remove it at once.
next, your program assigns, grade B to marks>=80 which includes marks>=90 also
similar mistakes for grade C & D too...
so your else if condition should be : (marks<90&&marks>=80) //for grade B of course...
I just want to apologise publicly to ajh32 for reporting your post above. I meant to report the post from Virginiajem that you were replying to, as that user is clearly a spambot, but I accidentally clicked on the wrong Report button. Sorry :(