Advertisement
makos

Untitled

Jul 23rd, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.68 KB | None | 0 0
  1. /*
  2.  * File:   main.c
  3.  * Author: mateusz
  4.  *
  5.  * Created on 22 lipiec 2011, 23:09
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. #ifdef _WIN32
  12. # include <windows.h>
  13. #else
  14. # include <unistd.h>
  15. #endif
  16.  
  17. #ifdef _WIN32
  18. # define CLEAR system("cls")
  19. # define SLEEP Sleep(2000)
  20. #else
  21. # define CLEAR system("clear")
  22. # define SLEEP sleep(2)
  23. #endif
  24.  
  25. int menu();
  26.  
  27. int main(int argc, char** argv) {
  28.     int choice_;
  29.    
  30.     printf("Welcome to my world.\n"
  31.             "What will you do?\n\n");
  32.     while(1) {
  33.         choice_ = menu();
  34.         switch(choice_) {
  35.             case 1:
  36.                 printf("Boom!");
  37.                 return 0;
  38.                 SLEEP;
  39.                 CLEAR;
  40.                 system("exit");
  41.             case 2:
  42.                 printf("You kill yourself. You moron.\n");
  43.                 printf("Few seconds later, identical clone appears in your place.\n");
  44.                 SLEEP;
  45.                 CLEAR;
  46.                 break;
  47.             case 3:
  48.                 printf("You try to run away, but the place looks like it has no "
  49.                     "boundaries. You eventually die.\n");
  50.                 printf("Few seconds later, identical clone appears in your place.\n");
  51.                 SLEEP;
  52.                 CLEAR;
  53.                 break;
  54.             default:
  55.                 printf("Wrong choice, try again.\n");
  56.                 SLEEP;
  57.                 CLEAR;
  58.                
  59.         }
  60.     }
  61.     getchar();
  62.     return 0;
  63. }
  64.  
  65. int menu() {
  66.     int choice;
  67.    
  68.     printf("1. Destroy this place.\n"
  69.             "2. Kill myself.\n"
  70.             "3. Get out from here.\n"
  71.             "> ");
  72.     scanf("%d", &choice);
  73.     return choice;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement