Question: Write a program named Lab6C that will determine if a student is in elementary, middle or high school based on his grade. Ask the user

  1. Write a program named Lab6C that will determine if a student is in elementary, middle or high school based on his grade.
  • Ask the user to input a grade level (1-12), and then use if statements to determine which school the student will attend elementary, middle or high school.
  • Grades 1-5 will be in elementary, 6-8 will be in middle school and 9-12 will be in high school.
  • Add a statement that checks for input failure when the user enters the grade. If theres an error, it should print an error message and exit the program. (This could be due to a letter being typed instead of a number.)
  • Use a switch statement to determine the students school, and print your results in the following format:

Grade studentGrade goes to studentSchool

So if the user types 8, the output would be

Grade 8 goes to middle school

If they enter 10, it would be

Grade 10 goes to high school

And so on.

NOTE: PROGRAM MUST BE IN C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!