0
I don't understand the switch statement, can someone help me out please
Switch
2 Respostas
+ 4
#include <stdio.h>
int main()
{
int x ;
cin>>x; //your ask for choice number
switch (x)//your your want to use switch and x user choice
{
case 1: printf("Choice is 1");//if user enter 1then this
break;
case 2: printf("Choice is 2");//if user enter 2 then this
break;
case 3: printf("Choice is 3");
break;
default: printf("Choice other than 1, 2 and 3");//if the answer is none of the above then this
break;
}
return 0;
}