Advertisement
makos

Untitled

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