write a program that can compute the grades of the students from pre-mid, midterm, pre-final, final and get the average then identify the average is:
below 74.5 "failed" , above 74.5 - 79.4 "passed" , 80 - 85 "Good" , 86 - 90 "very good" , 91 - 100 "excellent" and above 101 "invalid grades" using switch case statement.
... and what part of this assignment are you having difficulty with? Have you produced a program design? Do you understand the logic/algorithm required to compute the grades? How would you do this using pen/paper? What exact instructions would you give to someone else who hadn't seen the requirement for them to undertake this? What attempt has been made with the program? If you're produced a program design etc then what C++ issue are you having trouble with? Post your current code for further guidance.
Switch statements are good when you want to check for specific values but are normally less suitable when you want to check for ranges (because they can't). You also can't use them with floating-point numbers (it has to be an integer or enum type).
You could do it with switch statements but then you would have to convert the grades to integers and list all possible values (except you can have a default label which will catch all non-listed values). It's much easier to use if statements for this.
you can force fit a switch by finding a way to express what you need in integer terms.
some problems, that is really easy to do. Other problems, like this one, its way, way too much work to produce a bloated and slightly convoluted block of code.
So, yes, while if statements look better for this problem, be aware that you can make switches work if necessary.
why would a switch be necessary? Switches and the missing break fall-through concept can reduce complicated logic to much simpler logic. You do not need that here. (Realizing that you do not need it or that forcing the switch would be ugly just comes from experience. If you grow bored and have extra time you could try it and after you get it, the block of junk to get there will be a mess, not because of anything you did, but because of how it must be done).
speaking of that, can you think of a way to avoid testing a range and only test a little each time with if/else?
if(grade >= 91)
else if(grade >= 80)
... what happens? 95 is > 80, but ... that else prevents doing another term once you found an answer. And you did, its > 91.