0

I don't understand the switch statement, can someone help me out please

Switch

11th Mar 2019, 6:39 AM
Ugbeh
Ugbeh - avatar
2 Réponses
+ 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; } 
11th Mar 2019, 8:30 AM
Yash🏁🔘
Yash🏁🔘 - avatar
11th Mar 2019, 6:43 AM
Sebastian Keßler
Sebastian Keßler - avatar