|
-
October 16th, 2018, 11:32 PM
#1
Calculating Grades program (Passing grades) (Failing Grades) in C++
Hello everyone. I really need help with this assignment. It's for an online class and I didn't understand the lessons at all. I have been trying to figure out the code for 6 hours but I just don't understand how to solve this problem. Any help will be greatly appreciated by me and my fellow classmates.
This is the assignment. So far we have only learned about repetition using a while loop and logical operators. So please keep that in mind.
We want to count how many passing grades are entered. We don’t know how many grades there will be. Use a sentinel controlled while loop that will ask the user to enter student grades until a value of -1 is entered. Use a counter variable to count all the grades that are passing grades, where 70 is the minimum passing grade. If there are any grades that are out of the range 0 – 100 (meaning either less than zero or greater than 100), present an error message to the user, and do not count that grade as passing. We also would like to see the number of passing grades, the number of failing grades and the number of invalid grades.
Create two more test cases.
Use following one in addition to the two you create.
Grades Entered: Expected Results
45
90
70
87
123 “That is not a valid grade!”
100
-1 You entered 4 passing grades.
You entered one failing grade
You entered one invalid grade.
This is my code so far.
Code:
#include <stdio.h>
#include <stdlib.h>
main()
{
int score, sum=0;
printf("Enter a score (-1 to quit)");
scanf("%i", &score);
while (score != -1) {
}
system("pause");
}
Last edited by 2kaud; October 17th, 2018 at 02:13 AM.
Reason: Added code tags
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|