Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement a complete program that uses a switch statement In C + + . Demonstrate how to use the keyword break effectively, you should have
Implement a complete program that uses a switch statement In C Demonstrate how to use the keyword break effectively, you should have combine cases where appropriate by having only uses of break in your code and use of default.
Prompt the user for the score assumed to be an integer between and inclusive
Read the user input into a variable score of type int.
Also declare a variable called grade of type char.
Assign one of the values ABCDF or X to grade based on the value of score.
If score is or the grade is F
If the score is less than or the grade is D
If the score is the grade is C
If the score is the grade is B
If the score is or the grade is A
If the score is any other value the grade is X
After the switch statement, output the users grade eg
Your grade is A
Or
Invalid score.
Thats for that case where grade has the value X
please show the sample run
SAMPLE RUN :
Please enter the score:
B
SAMPLE RUN :
Please enter the score:
C
SAMPLE RUN :
Please enter the score:
Invalid score.
SAMPLE RUN :
Please enter the score:
A
SAMPLE RUN :
Please enter the score:
D
SAMPLE RUN :
Please enter the score:
F
PLEASE DO THIS IN C AND ONLY USE USES OF BREAK AND USE OF DEFAULT IN THIS CODE Thats it Thank you.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started