i am not assining the homework....its not essential to solve the problem using swtich....i can do it using if statement....but i cant find a way out using switch...thats why posted my problem here so i may be guided....please read this code and tell the mistake....the program runs but doesnt show any output
#include<iostream.h>
#include<conio.h>
#include<math.h>
main()
{
int marks;
cout<<"Enter the marks of the subject ";
cin>>marks;
switch(marks)
{
case 'marks>=85':
{
cout<<"The grade of the subject is A"
break;
switch statements are made to check equality. You can; however, always link your statement to a function that returns a value.
I, personally, don't use switch statements. I find it pointless to use it when I could use if/if else/else. The only time I used switch was when I created a table and needed to select an option for some operation... and it wasn't necessary, in fact.