<mosaic.cnfolio.com>
PROGRAM
  1. /* START
  2.    Scan Input for the number Pidgeys, Rattatas, Zubats, Pidgey Candy, Rattata Candy and Zubat Candy   
  3.    Set Pidgey Candy Requirement = 12
  4.    Set Rattata Candy Requirement = 25
  5.    Set Zubat Candy Requirement = 50
  6.    Make the maximum number of Pidgey evolutions available = the number of Pidgey Candy divided by 12
  7.    Make the maximum number of Rattata evolutions available = the number of Pidgey Candy divided by 25
  8.    Make the maximum number of Zubat evolutions available = the number of Pidgey Candy divided by 50   
  9.    Display Instructions
  10.    IF the number of Pidgeys is less than 1
  11.       THEN
  12.          Display: “You don't have one of these - You need to go hunting for a Pidgey”
  13.          Set Pidgey XP to 0
  14.       ELSE
  15.          IF then number of Pidgey Candy is less than 12
  16.             THEN
  17.                Display: “Running Low on Candy - You need more Pidgey Candy”
  18.             ELSE
  19.                IF the max number of Pidgey evolutions available is less than or equal to the number of Pidgeys
  20.                   THEN
  21.                      Set Pidgey XP to the number of Pidgey evolutions available multiplied by 500
  22.                      Display: “Pidgey XP=#” where # is the amount of XP gained
  23.                   ELSE
  24.                      Set Pidgey XP to the number of Pidgeys owned multiplied by 500
  25.                      Display: “Pidgey XP=#” where # is the amount of XP gained
  26.    IF the number of Rattatas is less than 1
  27.       THEN
  28.          Display: “You don't have one of these - You need to go hunting for a Rattata”
  29.          Set Rattata XP to 0
  30.       ELSE
  31.          IF then number of Rattata Candy is less than 12
  32.             THEN
  33.                Display: “Running Low on Candy - You need more Rattata Candy”
  34.             ELSE
  35.                IF the max number of Rattata evolutions available is less than or equal to the number of Rattatas
  36.                   THEN
  37.                      Set Rattata XP to the number of Rattata evolutions available multiplied by 500
  38.                      Display: “Rattata XP=#” where # is the amount of XP gained
  39.                   ELSE
  40.                      Set Rattata XP to the number of Rattatas owned multiplied by 500
  41.                      Display: “Rattata XP=#” where # is the amount of XP gained
  42.    IF the number of Zubats is less than 1
  43.       THEN
  44.          Display: “You don't have one of these - You need to go hunting for a Zubat”
  45.          Set Zubat XP to 0
  46.       ELSE
  47.          IF then number of Zubat Candy is less than 12
  48.             THEN
  49.                Display: “Running Low on Candy - You need more Zubat Candy”
  50.             ELSE
  51.                IF the max number of Zubat evolutions available is less than or equal to the number of Zubats
  52.                   THEN
  53.                      Set Zubat XP to the number of Zubat evolutions available multiplied by 500
  54.                      Display: “Zubat XP=#” where # is the amount of XP gained
  55.                   ELSE
  56.                      Set Zubat XP to the number of Zubats owned multiplied by 500
  57.                      Display: “Zubat XP=#” where # is the amount of XP gained
  58.    Make Total XP equal to Pidgey XP plus Rattata XP plus Zubat XP
  59.    Make Total XP with Lucky Egg Bonus equal Total XP multiplies by 2
  60.    Display: “Total XP=#” where # is the total XP gained
  61.    Display: “Total XP with a Lucky Egg=#” where # is the total XP gained if a Lucky Egg has been activated
  62.    IF a possible error has been found with an input
  63.       THEN
  64.          Display: “POTENTIAL INPUT ERROR - Check that all inputs are integers and have been entered correctly”
  65.       ELSE
  66.          Continue
  67. END */
  68.  
  69. #include <stdio.h>               /* Include the Standard Input Output C Library */
  70. int main (void)                  /* Begin the Program */
  71. {
  72. int xp,eggxp,syntax;     /* Create Titles xp(Total XP), eggxp(Total XP with Egg Bonus) and syntax(checking for errors */
  73. int pidgey,pcandy,prqd,pevolve,pxp;   /* Create Titles for the Pidgey Calculations */
  74. int rattata,rcandy,rrqd,revolve,rxp;         /* Create Titles for the Rattata Calculations */
  75. int zubat,zcandy,zrqd,zevolve,zxp;      /* Create Titles for the Zubat Calculations */
  76.    
  77. scanf( "%d %d %d %d %d %d", &pidgey, &pcandy, &rattata, &rcandy, &zubat, &zcandy)/* Scan for the six inputs, number of pokemon and pieces of candy for Pidgey, Rattata and Zubat */
  78. prqd=12;      /* Set the Pidgey evolution requirement to 12 */
  79. rrqd=25;      /* Set the Rattata evolution requirement to 25 */
  80. zrqd=50;      /* Set the Zubat evolution requirement to 50 */
  81. pevolve=pcandy/prqd;     /* Set Pidgey Maximum Evolutions to the number of candy divided by its evolution requirement */
  82. revolve=rcandy/rrqd;     /* Set Rattata Maximum Evolutions to the number of candy divided by its evolution requirement */
  83. zevolve=zcandy/zrqd;     /* Set Zubat Maximum Evolutions to the number of candy divided by its evolution requirement */
  84. syntax=0;                  /* Set Syntax to 0 because no errors could have been found with inputs yet */
  85.          
  86. if (pcandy>30000)     /* When inputs are left blank, they are made to be greater than 30,000 */
  87. {
  88. pcandy=0;                  /* If this happens to the Pidgey candy input, the values will be replaced with 0 */
  89. }
  90. if (rcandy>30000)     /* When inputs are left blank, they are made to be greater than 30,000 */
  91. {
  92. rcandy=0;                  /* If this happens to the Rattata candy input, the values will be replaced with 0 */
  93. }
  94. if (zcandy>30000)     /* When inputs are left blank, they are made to be greater than 30,000 */
  95. {
  96. zcandy=0;                  /* If this happens to the Zubat candy input, the values will be replaced with 0 */
  97. }
  98. if (pidgey>30000)     /* When inputs are left blank, they are made to be greater than 30,000 */
  99. {
  100. pidgey=0;                  /* If this happens to the Pidgey number input, the values will be replaced with 0 */
  101. }
  102. if (rattata>30000)               /* When inputs are left blank, they are made to be greater than 30,000 */
  103. {
  104. rattata=0;            /* If this happens to the Rattata number candy input, the values will be replaced with 0 */
  105. }
  106. if (zubat>30000)          /* When inputs are left blank, they are made to be greater than 30,000 */
  107. {
  108. zubat=0;      /* If this happens to the Zubat number candy input, the values will be replaced with 0 */
  109. }
  110.        
  111. printf("Six Integers are to entered in the following order; \n")/* Display these instructions to the top of the output box */
  112. printf("1.Pidgeys Owned     2.Pidgey Candy Owned\n");   /* The instruction tell the user what order to put the inputs into */
  113. printf("3.Rattatas Owned    4.Rattata Candy Owned\n");         /* It tells the user to put pokemon numbers first, then the respective candy */
  114. printf("5.Zubats Owned      6.Zubat Candy Owned\n\n");         /* In the order Pidgey, Rattata and finally Zubat */
  115. printf("!!!Please Ensure This Is Correct Before Continuing!!!\n\n")/* It also advises the user to check the inputs to avoid discrepancies */
  116.      
  117. if (pidgey < 1)                  /* If the user has less than 1 pidgey there will be no XP gain from a pidgey evolution */
  118. {
  119. printf("You don't have one of these - You need to go hunting for a Pidgey\n");      /* Display the message stating that you have no Pidgeys */
  120. pxp=0;                     /* Set the Pidgey XP to 0 */
  121. syntax=1;                  /* Flags up a possible input error */
  122. }
  123. else              /* If there is 1 or more Pidgeys, carry on */
  124. {
  125. if (pcandy < 12)          /* If there is less than 12 Pidgey Candy, no evolution can take place */
  126. {
  127. printf("Running Low on Candy - You need more Pidgey Candy\n")/* Display a message stating that you do not have enough candy to evolve a Pidgey */
  128. pxp=0;                     /* Set Pidgey XP to 0 */
  129. syntax=1;                  /* Flag up a possible input error */
  130. }
  131. else              /* If there are 12 or more pieces of candy, carry on */
  132. {
  133. if (pevolve <= pidgey)          /* If the Pidgeys maximum evolutions is less than or equal to the number of Pidgeys, that number of evolutions will take place */
  134. {
  135. pxp=pevolve*500;          /* Set the Pidgey XP Gain to the maximum number of evolutions multiplied by 500 */
  136. printf("Pidgey  XP=%d\n", pxp);        /* Display the amount of XP gained by evolving the Pidgeys */
  137. }
  138. else              /* If the Pidgeys maximum evolutions is greater than the number of Pidgeys, the number of Pidgeys will be the number of evolutions taking place */
  139. {
  140. pxp=pidgey*500;                  /* Set Pidgey XP to the number of Pidgeys multiplied by 500 */
  141. printf("Pidgey  XP=%d\n", pxp);        /* Display the amount of XP gained by evolving the Pidgeys */
  142. }}}
  143.                  
  144. if (rattata < 1)          /* If the user has less than 1 Rattata there will be no XP gain from a Rattata evolution */
  145. {
  146. printf("You don't have one of these - You need to go hunting for a Rattata\n")/* Display the message stating that you have no Rattatas */
  147. rxp=0;                     /* Set the Rattata XP to 0 */
  148. syntax=1;                  /* Flags up a possible input error */
  149. }
  150. else              /* If there is 1 or more Rattatas, carry on */
  151. {
  152. if (rcandy < 25)          /* If there is less than 12 Rattata Candy, no evolution can take place */
  153. {
  154. printf("Running Low on Candy - You need more Rattata Candy\n");   /* Display a message stating that you do not have enough candy to evolve a Rattata */
  155. rxp=0;                     /* Set Rattata XP to 0 */
  156. syntax=1;                  /* Flag up a possible input error */
  157. }
  158. else              /* If there are 12 or more pieces of candy, carry on */
  159. {
  160. if (revolve <= rattata)     /* If the Rattatas maximum evolutions is less than or equal to the number of Rattatas, that number of evolutions will take place */
  161. {
  162. rxp=revolve*500;          /* Set the Rattata XP Gain to the maximum number of evolutions multiplied by 500 */
  163. printf("Rattata XP=%d\n", rxp);        /* Display the amount of XP gained by evolving the Rattatas */
  164. }
  165. else              /* If the Rattatas maximum evolutions is greater than the number of Rattatas, the number of Rattatas will be the number of evolutions taking place*/
  166. {
  167. rxp=rattata*500;          /* Set Rattata XP to the number of Rattatas multiplied by 500 */
  168. printf("Rattata XP=%d\n", rxp);        /* Display the amount of XP gained by evolving the Rattatas */
  169. }}}     
  170.      
  171. if (zubat < 1)      /* If the user has less than 1 Zubat there will be no XP gain from a Zubat evolution */
  172. {
  173. printf("You don't have one of these - You need to go hunting for a Zubat\n")/* Display the message stating that you have no Zubats */
  174. zxp=0;                     /* Set the Zubat XP to 0 */
  175. syntax=1;                  /* Flags up a possible input error */
  176. }
  177. else              /* If there is 1 or more Zubats, carry on */
  178. {
  179. if (zcandy < 50)          /* If there is less than 12 Zubat Candy, no evolution can take place */
  180. {
  181. printf("Running Low on Candy - You need more Zubat Candy\n")/* Display a message stating that you do not have enough candy to evolve a Zubat */
  182. zxp=0;                     /* Set Zubat XP to 0 */
  183. syntax=1;                  /* Flag up a possible input error */
  184. }
  185. else              /* If there are 12 or more pieces of candy, carry on */
  186. {
  187. if (zevolve <= zubat)               /* If the Zubats maximum evolutions is less than or equal to the number of Zubats, that number of evolutions will take place */
  188. {
  189. zxp=zevolve*500;          /* Set the Zubat XP Gain to the maximum number of evolutions multiplied by 500 */
  190. printf("Zubat   XP=%d\n", zxp);        /* Display the amount of XP gained by evolving the Zubats */
  191. }
  192. else              /* If the Zubats maximum evolutions is greater than the number of Zubats, the number of Zubats will be the number of evolutions taking place */
  193. {
  194. zxp=zubat*500;      /* Set Zubat XP to the number of Zubats multiplied by 500 */
  195. printf("Zubat   XP=%d\n", zxp);        /* Display the amount of XP gained by evolving the Zubats */
  196. }}}
  197.          
  198. xp=pxp+rxp+zxp;                  /* Set Total XP to Pidgey XP plus Rattata XP plus Zubat XP */
  199. eggxp=xp*2;      /* Set Total XP with Lucky Egg bonus to the Total XP multiplied by 2 */
  200. printf("\nTotal XP=%d\n",xp);    /* Display the Total XP */
  201. printf("Total XP with a Lucky Egg=%d\n", eggxp);   /* Display the Total XP when using a Lucky Egg Bonus */
  202.          
  203. if (syntax >= 1)          /* If a syntax error has been flagged, an input is either wrong, 0 or less than the required pieces of candy */
  204. {
  205. printf("\nPOTENTIAL INPUT ERROR - Check that all inputs are integers and have been entered correctly")/* Displays an Error message explaining that there could be an error with the input */
  206. }}