<mosaic.cnfolio.com>
PROGRAM
1. /*
2. PSEUDO Code:
3.
4.    Set pidgeycount to number of pidgey's.
5.    Set pidgeycandy to number of candies.
6.    Set pidgeyevolve to 12.
7.    Set luckyeggexp to 1000.
8.
9.    GET  pidgeycount GET pidgeycandy
10.
11. Start
12.
13.    IF
14.       The pidgeycount is equal to 1, PRINT that you have one Pidgey.
15.       THEN
16.          PRINT that the pidgeycount is the number of Pidgey's that have been entered.
17.       ELSE IF
18.       The pidgeycount is equal to or greater than 2
19.          PRINT the number of Pidgey's entered.
20.       END IF
21.    END IF
22. END IF
23.
24. End
25.
26. Start
27.
28.    CASE pidgeycount
29.       Set case 0
30.       PRINT that the user does not have any Pidgey's so they need to enter one.
31.       BREAK
32.    END CASE
33.
34. End
35.
36. Start
37.
38.
39.    IF
40.       The input is equal to 1, print how many times you can evolve the Pidgey.
41.       THEN
42.          PRINT how many evolutions you can make, CALCULATE the pidgeycandy divided by pidgeyevolve.
43.       ELSE IF
44.       The pidgeycount is greater than or equal to 2
45.          PRINT how many evolutions you can make, CALCULATE the pidgeycandy divided by pidgeyevolve.
46.       END IF
47.    END IF
48. END IF
49. End
50.
51. Start
52.
53.    CASE pidgeycandy
54.       Set case 11 case 10 case 9 case 8 case 7 case 6 case 5 case 4 case 3 case 2 case 1 case 0
55.       PRINT that the user does not have enough candies to make an evolution.
56.       BREAK
57.    END CASE
58.
59. End
60.
61. Start
62.
63.    IF
64.       DETERMINE if pidgeycount is greater than or equal to 1 and if pidgeycandy is greather than or equal to 12.
65.          PRINT pidgeycandy divided by pidgeyevolve multiplied by luckyeggxp.
66.    END IF
67.
68. End
69.
70. */
71. #include <stdio.h>
72.
73. int main ( void )
74. {
75.    int pidgeycount, pidgeycandy; /* The integer pidgeycount and integer pidgeycandy are both set to what the user inputs. */
76.    int pidgeyevolve = 12;      /* This is the variable for the Pidgey evolutions which is set to 12 candies, the number needed for each evolution. */
77.    int luckyeggxp = 1000;         /* This is the variable for the total amount of XP that can be earned for each evolution. */
78.
79.    scanf( "%d %d", &pidgeycount, &pidgeycandy ); /* This scan functions holds both inputs, one
80.    for Pidgey's and one for Candies. */
81.
82.       if  ( pidgeycount == 1 ){
83.          printf( "You have one Pidgey", pidgeycount ); /* This will print if only one Pidgey has been input. */
84.       }else if ( pidgeycount >= 2 ){
85.          printf( "You have %d Pidgey’s", pidgeycount ); /* If the user has more than one, this will
86.          display that result */
87.       }
88.
89.       switch (pidgeycount)
90.       {  case 0:
91.             printf( "You have zero Pidgey's, you need at least one to make an evolution" );
92.          break;
93.       } /* I added this switch, changing from using IF as it allowed for my code to look neater and it is
94.          simpler than using nested IF statements. */
95.
96.       if ( pidgeycount == 1 ){ /* The first part of the IF determines that if you have 1 Pidgey,
97.       you can evolve it however many times is possible with the number of candies held. */
98.          printf ( " and you can evolve your Pidgey %d times, ", pidgeycandy / pidgeyevolve ); /* This will print how many times you can evolve one Pidgey if the input was one. */
99.       }else if ( pidgeycount >= 2 ){
100.          printf ( " and you can evolve your Pidgey's %d time(s), ", pidgeycandy / pidgeyevolve );
101.          /* This will print how many times you can evolve more than one Pidgey if the input was more than one. */
102.       }
103.
104.       switch (pidgeycandy) /* This Switch is for error handling, which I have used improve my code. */
105.       {  case 11: case 10: case 9: case 8: case 7: case 6: case 5: case 4: case 3:
106.          case 2: case 1: case 0: /* Case 11 to 0 runs when the number of candies is below 12, and prints the error */
107.         printf( "\nYou also do not have enough Candy to evolve your Pidgey(s)." );
108.          break;
109.       } /* I decided to change my IF statement to a SWITCH statement as it is more accurate at
110.          detecting an input below 12, which it will then run the error that there is not enough
111.          candy to evolve a Pidgey. */
112.
113.       if ( pidgeycount >= 1 && pidgeycandy >= 12){ /* This looks at saying if the number of Pidgey's
114.          is greater than or equal to one, so it will display the XP you can earn, if it is zero, the error will run. */
115.          printf ( "You will earn %d XP!", pidgeycandy / pidgeyevolve * luckyeggxp); /* This is a
116.          simple PRINT and it calculates the total XP earned with the lucky egg XP bonus. */
117.       }
118.
119. }