Use a do-while statement, write a program that continuously requests a grade to be entered. If the grade is less that 0 or greater than 100, your program should print an appropriate message informing the user that an invalid grade has been entered, the program should exit the repetition loop and compute and display the average of the valid grades entered.

im still a student and i cant get the code out of this

Sample output 1:

Enter grade :85
Enter Grade:90
Enter grade:0

Invalid Grade:
Average Grade: 87.5

Sample Output 2:

Enter grade:90
Enter Grade:90
Enter grade:80
Enter Grade:75
Enter Grade:102


Invalid grade:
Average Grade:87.4???? help me with this???

Recommended Answers

All 3 Replies

could we see some code? its kinda hard to see you computer screen from here

My guess is he hasn't written a line yet, looks like an assigment to me.
Anyways your program should tell the user that a grade is invalid if it's 0<= or =>100. This should also terminate the program and print the average grade which is computeded as such

(grade[1]+grade[2]+grade[number])/ amount of grades.

//K0ns3rv

Use cout and cin to obtain user input.
Use if statements to test if the input is valid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.