Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in the C language Write a program that assigns test score grades. The program's input should be a series of test scores of type int

in the C language Write a program that assigns test score grades. The program's input should be a series of test scores of type int. Have the program read each score and print either the corresponding grade or an appropriate error message. The program is to continue until end-of-file. If invalid character data is entered, you will need to flush the invalid characters so that test scores can continue to be entered until end-of-file.

please write the program that is similar to the code below

while((r=scanf("%i" & score))!=EOF) { if(r==0) // invalid char { printf(""); while(getChar()!=' '); } else switch(score) }

Assume the following grading scale:

9 - 10 A

8 B

7 C

6 D

0 - 5 F

Use a switch statement to assign or print the appropriate grade.

Run your program using the following input:

1. All of the values between 0 and 10, inclusive

2. A negative value

3. A value greater than 10

4. A character value

Run the program with a valid value after all of these error cases to verify that the bad data was flushed correctly.

USE the correct use of local variables, local prototypes, and parameter passing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions