Question: What is wrong with the following switch statement? int ans; cout ' Type y for yes on n for noln: cin ans; switch ( ans

What is wrong with the following switch statement? int ans; cout 'Type y for yes on n for noln": cin ans; switch (ans)
I
case y2 :
case Y : cout "You said yesin";
break;
case 'n :
case 'N: cout "You said noln";
break
default cout "invalid answer nn;
}
a. ans is a int
b. break is illegal syntax
c. nothing
d. there are no break statements on 2 cases
What is wrong with the following switch

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 Programming Questions!