Feedback

The Switch Statement

Last Tuesday, July 31, 2012, we continued our regular tutorial sessions with the First year. Since we haven't followed the flow of their discussions at the university, we tried to ask them questions if which part of their discussions they find it hard most. Majority answered the switch statement so we give it shot.

I know you guys find it hard to follow my discussion since they were mostly vocal so I'll show you the complete code on how to do it. The switch statement code that I gave you as an example are as follows:

#include<stdio.h>
#include<conio.h>

int main(){
 char choice='';
 clrscr();
 
 printf("Press [A] to Resume [B] for New Game and [C] to Exit\n");
 scanf("%c", &choice);
 
 switch(choice){
  case 'A':{
     printf("Please wait, resuming game. . .");
    };break;
  case 'B':{
     printf("Please wait, Starting New Game. . .");
    };break;
  case 'C':{
     printf("Exiting. . .");
    };break;
  default:{
     printf("Invalid Input!");
    };
 }
 
 getch();
}


For questions, feel free to comment below and we would gladly try our best to reply to each of your concerns.

Next Topic: The If...Else condition.