RE: what's wrong with my code 08-08-2014, 12:52 PM
#11
(08-08-2014, 09:10 AM)Snipa Wrote: okay i noticed something, i tried to print the value of "select" , turns out it's not what you want it to be "1" "2" "3" "4" that's why your program jumped directly to the default section.
i removed the text written with the scanf,and modified the case statement.
you made it to check if the input is a char by using single quotation '1' instead of simply 1 since its an integer
Code:#include<stdio.h> #include<conio.h> int main () { int select; printf("1)Start the game \n2)Options \n3)About game \n4)Exit the game\nPress a number "); scanf("%d", &select); switch (select){ case 1: printf("Loading..."); break; case 2: printf("1)Sound \n2)Controle \n3)Graphics"); break; case 3: printf("This game was created by Mohamed OMARI\nhe takes all the credit."); break; case 4: printf("Are you sure \nPress any key to continue..."); break; default: printf("Wrong section"); break; } getch(); return 0; }
Snipa, Coding!


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)