How to identify range

Write a C++ program that gets an input mark from the user and then displays the grade of the mark, based on the following table. The mark should be entered in one decimal place. Use the switch statement.

Mark Grade
80 to 100 A
60 to 79.9 B
50 to 59.9 C
0 to 49.9 F


Hey guys just want to inquire what is the range assignment operator like for example 80 to 100 , how do i assign it as a range in the switch statement . A sample of the program would be really appropriate , thanks in advance :)

if (x>=80 && x<=100)
Last edited on
Why use a switch, I think switch only works with ints or chars.

if (num_grade>=80 && num_grade<=100) grade='A';
else if (num_grade>60) grade='B';
etc...
Last edited on
Topic archived. No new replies allowed.