Please always use code tags:
total = (grade1 + grade2 + grade3 + grade4) / 4;
That is doing integer division, probably not what you want.
total = (grade1 + grade2 + grade3 + grade4) / 4.0
forces the promotion to double. I always put digits before and after the decimal place for doubles, it prevents these type of errors. Remove the first time you have that statement: you don't have the data yet.
grade1 = 0;
Is more efficiently written as:
int grade1 = 0; // declaration and assignment in one statement.
Generally one can wait until there is a sensible value before doing declaration and assignment.
|Don't forget return 0;|
that isn't actually required in C++, but there is no harm in having it anyway.
is a good idea, learn C++ , not C.
statement is used in a loop, not an
statement. It means start the loop again, so it makes no sense in an
With the cout , always read the documentation about things you are not sure about.
Good Luck !!