<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. Get
  3. name of pokemon
  4. number of that pokemon
  5. number of candies
  6.  
  7. if
  8. pokemon input does not equal first array
  9. else
  10. if
  11. pokemon input does not equal array number two
  12. else
  13. if
  14. pokemon input does not equal array number three
  15. else
  16. print "you have input an invalid pokemon"
  17.  
  18. If
  19. input number of pidgeys does not equal an interger
  20. Then
  21. display "you have input an unrecognised interger"
  22.  
  23. If
  24. input number of candies does not equal an interger
  25. Then
  26. dispay "you have input an unrecognised intereger"
  27.  
  28. number of evolutions = candies/12 rounded down
  29.  
  30. Calculate experiance
  31. candies/12 equals experiance gained
  32. experiance gained multiplied by 1000 = experiance gained
  33.  
  34. if
  35. Evolutionpoints is bigger than number of pokemons
  36. evolved = number of poekmons
  37.  
  38. else
  39. if
  40. Evolutionpoints is equal to number of pokemons
  41. evolved = number of poekmons
  42.  
  43. else
  44. if Evolutionpoints is smaller than number of pokemons
  45. evolved = Evolutionpoints
  46.  
  47.  
  48. If
  49. candies is not bigger than 12
  50. Then
  51. diplay "you do not have enough candies"
  52. Else
  53.  
  54. If
  55. pidgies is not bigger than 0
  56. Then
  57. display "you do not have enough candies"
  58.  
  59. If
  60. number of pidgies is less than or equal to the number of evoloutions
  61. Then
  62. number of pidgies multiplied by 1000 = experinace gained
  63. display experiance gained
  64.  
  65. If
  66. candies is equal to or equal to 12 and the number of pidgies is larger than 0
  67. Then
  68. display experinace gained
  69.  
  70. End of code
  71.  
  72. */
  73.  
  74. #include <stdio.h>
  75. #include <math.h>
  76.  
  77.  
  78. int main (void)
  79. {
  80. int number; /* number of pokemons */
  81. int input_candy;
  82. float output_result;
  83. float Evolutionpoints;
  84. int INPUTC; /* input candies*/
  85. int INPUTP; /* input pidgies/ pokemon */
  86. char pokemon[3][10] = {"pikachu","pidgy","zubat"}; /* pokemon choice */
  87. float output_noegg;
  88. char choice[10];
  89. int evolved; /* number of evloved pokemons */
  90.  
  91. scanf ("%s", &choice);
  92.  
  93. if (strncmp (pokemon[0],choice,strlen(choice)) == 0);
  94.  
  95. else
  96. if (strncmp (pokemon[1],choice,strlen(choice)) == 0);
  97.  
  98. else
  99. if (strncmp (pokemon[2],choice,strlen(choice)) == 0);
  100.  
  101. else
  102. {
  103. printf ("you have picked an invalid pokemon, pick a `pikachu`, `pidgy` or `zubat`. in lowercase.\n");
  104. return 0;
  105. }
  106.  
  107. /* the above section is an error paragraph for the pokemons input, so you can only pick pidgy, pikachu or zubat and nothing else */
  108.  
  109. INPUTP = scanf ("%d", &number);
  110.  
  111. if (INPUTP == 1)
  112. ;
  113. else
  114. if (INPUTP != 1)
  115. {printf ("Error you have input an unrecognised interger.\n");
  116. return 0;}
  117.  
  118. INPUTC = scanf ("%d", &input_candy);
  119.  
  120. if (INPUTC == 1)
  121. ;
  122. else
  123. if (INPUTC != 1)
  124. {printf ("Error you have input an unrecognised interger.\n");
  125. return 0;}
  126.  
  127. /* the above section manages the error messages for the number of pokemons and the number of candies */
  128.  
  129. Evolutionpoints = floor(input_candy/12);
  130.  
  131. output_result = (input_candy/12);
  132. output_result = floor (output_result);
  133. output_noegg = output_result*500; /* no egg experiance */
  134. output_result = output_result*1000; /* egg experiance */
  135.  
  136. if (Evolutionpoints > number)
  137. evolved = number;
  138. else
  139. if (Evolutionpoints == number)
  140. evolved = number;
  141. else
  142. if (Evolutionpoints < number)
  143. evolved = Evolutionpoints;
  144.  
  145. /* above section calculates the number of times the pokemon had evolved */
  146.  
  147. printf ("You have gained an additional %d %s candies!\n",evolved , choice);
  148.  
  149. if (!(input_candy>= 12))
  150. {printf ("You do not have enough candies.\n");
  151. return 0;}
  152. else
  153. if (!(number >0))
  154. {printf ("You do not have any %s`s!\n", choice);
  155. return 0;}
  156.  
  157. if (number <= Evolutionpoints)
  158. {
  159. output_noegg = number * 500;
  160. number = number * 1000;
  161. printf ("Your %s has evloved %d time(s)! and you've gained %d exp points with the lucky egg timer.\nYou would have gained %.0f exp points without out the lucky egg timer.\n", choice, evolved, number, output_noegg );
  162. exit (0);
  163. }
  164.  
  165. if (input_candy < 12)
  166. printf ("You do not have enough candies to evolve a %s.\n", choice);
  167.  
  168. else
  169. if (input_candy >= 12 && number > 0)
  170. {
  171. printf ("Your %s has evolved %d time(s)! and you have gained %.0f exp points with the lucky egg timer!\nYou would have gained %.0f exp points without the lucky egg timer\n",choice, evolved, output_result, output_noegg);
  172. }
  173.  
  174. }