thenewboston

C Programming Tutorial - 31 - switch

Aug 22nd, 2014
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <math.h>
  6.  
  7. int main()
  8. {
  9.     char grade = 'C';
  10.  
  11.     switch(grade){
  12.         case 'A' : printf("Sweet! \n" );
  13.         break;
  14.         case 'B' : printf("Could have tried harder \n" );
  15.         break;
  16.         case 'C' : printf("I C you didnt study \n" );
  17.         break;
  18.         case 'D' : printf("You love the D \n" );
  19.         break;
  20.         case 'F' : printf("That's embarrassing \n" );
  21.         break;
  22.         default : printf("That doesnt even make sense \n" );
  23.     }
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment