Advertisement
Guest User

D&D code task

a guest
Sep 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.04 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<ctype.h>
  4.  
  5. int main()
  6. {
  7.     int num;
  8.     int error;
  9.     int VariableRace;
  10.     int WizardLevel;
  11.     int friendship;
  12.     printf("Please only use the numbers 1,2 and 3 to select different options");
  13.     printf("Which race are you?\n1.Goblin\n2.Elf\n3.Wizard\n");
  14.     scanf("%d",&num);
  15.     error=(isdigit(num));
  16.     if (error==0)
  17.     {
  18.                  switch(num)
  19.                  {
  20.                             case 1:
  21.                                  printf("\tHave you:\n\t1.Eaten\n\t2.Not Eaten\n");
  22.                                  scanf("%d",&VariableRace);
  23.                                  if(VariableRace==2)
  24.                                  {
  25.                                                     printf("Go eat you horrible goblin");                    
  26.                                  break;
  27.                             case 2:
  28.                                   printf("\tDo you have the power of\n\t1.Sight\n\t2.Sound\n");
  29.                                   scanf("%d",&VariableRace);
  30.                                   break;
  31.                             case 3:
  32.                                   printf("\tWhat level of wizarding are you at:\n\t1.High\n\t2.Medium\n\t3.Low\n");
  33.                                   scanf("%d",&WizardLevel);
  34.                                   switch(WizardLevel)
  35.                                   {
  36.                                                       case 1:
  37.                                                       printf("\t\tYou have insight into the wizarding world but what element have\n\t\tyou mastered?\n\t\t1.Fire\n\t\t2.Wind\n\t\t3.Water\n");
  38.                                                       scanf("%d",&VariableRace);
  39.                                                       break;
  40.                                                       case 2:
  41.                                                       printf("\t\tYou may have passed the basics but can you:\n\t\t1.Fly\n\t\t2.Turn Invisible\n");
  42.                                                       scanf("%d",&VariableRace);
  43.                                                       break;
  44.                                                       case 3:
  45.                                                       printf("\t\tGo back to wizarding school");
  46.                                                       break;
  47.                                   }
  48.                  }
  49.     if (VariableRace==1)
  50.     {
  51.                          printf("You are welcome into my Dungeon filled with Dragons however are you \n1.friend?\n2.foe?");
  52.                          scanf("%d",&friendship);
  53.                          if (friendship==1)
  54.                          {
  55.                                            print("Please come in and make yourself at home");
  56.                          }
  57.                          else
  58.                          {
  59.                              printf("YOU DIED");
  60.                          }
  61.     }
  62.     else
  63.     {
  64.         printf("You are not welcome in my abode");
  65.     }
  66.     system("pause");
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement