Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.     unsigned char c;
  5.  
  6.     printf("Welcome to the game console selection helpdesk!\nDo you like video games? (y/n) ");
  7.     c = getchar(); getchar();
  8.     printf("You entered: '%c'\n", c);
  9.  
  10.     if (c == 'n') {
  11.         printf("Our advise: buy a PC\n");
  12.     }
  13.     else if (c == 'y') {
  14.         printf("Do you have any friends? (y/n) ");
  15.         c = getchar(); getchar();
  16.         printf("You entered: '%c'\n", c);
  17.  
  18.         if (c == 'n') {
  19.             printf("Our advise: buy a PS3\n");
  20.         }
  21.         else if (c == 'y') {
  22.             printf("Do you ever meet your friends off-line? (y/n) ");
  23.             c = getchar(); getchar();
  24.             printf("You entered: '%c'\n", c);
  25.  
  26.             if (c == 'n') {
  27.                 printf("Our advise: buy a Xbox360\n");
  28.             }
  29.             else if (c == 'y') {
  30.                 printf("Our advise: buy a Wii\n");
  31.             }
  32.         }
  33.     }
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement