<mosaic.cnfolio.com>
PROGRAM
1. #include<stdio.h>
2.
3. #define Experience 500                     /* Define evolutionary experience constant */
4.
5. #define Firstcandy 12                      /* Defines the candy needed for the first evolution */
6.
7. #define Secondcandy 50
8.
9. #define Luckyegg 2                         /* Define using lucky eggs to gain experience multiple */
10.
11. int calculate1(int Candy);                /* The function of the first number of evolution is less than the number of elves to obtain experience statement */
12.
13. int calculate2(int Pidegy,int Candy);     /* The number of times of the first evolution is greater than that of the elves function */
14.
15. int calculate3(int Pidgey,int Candy);     /* The function declaration explains the size of the first evolution and the number of sprites*/
16.
17. int calculate4(int Candy);                /* Use Lucky Eggs for the first time the number of evolution is less than the number of elves to gain experience of function declarations */
18.
19. int calculate5(int Pidgey,int Candy);     /* Use Lucky Eggs for the first time the number of evolution is greater than the number of elves to gain experience in the function declaration */
20.
21. int main()                                /* Main function */
22.
23. {
24.          int n_Candy;                     /* Defines integer variables, candy quantities */
25.
26.          int n_luckyegg;                  /* Defines integer variables, lucky egg quantites */
27.
28.          int n_Pidgey;                    /* Defines integer variables, pidgey quantites */
29.
30.          int result2;                     /* Defines an integer variable, the experience gained when the first evolution is less than the number of elves */
31.
32.          int result3;                     /* Define an integer variable, the experience gained when the first evolution is greater than the number of elves */
33.
34.          int result4;                     /* Defines an integer variable, when the evolution of the first frequency and the relationship between the number of Elves */
35.
36.          int result5;                     /* Defines an integer variable, the experience gained when the first evolution is less than the number of elves and using lucky eggs*/
37.
38.          int result6;                     /* Defines an integer variable, the experience gained when the first evolution is greater than the number of elves and using lucky eggs*/
39.
40.          int result7;                     /* Defines an integer variable, the number of candies remaining when the first evolution has been made */
41.
42.          int result8;                     /* Defines an integer variable, the number of times of the second evolution */
43.
44.          int result9;                     /* Defines an integer variable, when the evolution of the second frequency and the relationship between the number of Elves */
45.
46.          printf("Evolutionary experience&#65306;%d\n",Experience);          /* Show tips for evolutionary gaining experience */
47.
48.          first:printf("Input the number of Pidgey\n");                /* The prompt is displayed */
49.
50.          scanf("%d",&n_Pidgey);                                       /* Input the number of Pidgey */
51.
52.          printf("The number of your Pidgey:%d.\n",n_Pidgey);          /* The prompt is displayed */
53.
54.          if (n_Pidgey<0)                                              /* Determine if the pidgey number is less than zero */
55.
56.          {
57.
58.          printf("input error,please input out again:\n");             /* The prompt is displayed */
59.          goto first;                                                  /* Jump to first */
60.
61.          }
62.
63.          else                                                         /* Judgment is false */
64.
65.          {
66.
67.          second:printf("Input the number of Pidgey Candy\n");         /* The prompt is displayed */
68.
69.          scanf("%d",&n_Candy);                                        /* Input the number of Candy */
70.
71.          printf("The number of your Pidgey cnady:%d.\n",n_Candy);     /* The prompt is displayed */
72.
73.          }
74.
75.         if (n_Candy<0)                                                /* Determine if the candy number is less than zero */
76.
77.        {
78.
79.          printf("input error,please input out again:\n");             /* The prompt is displayed */
80.
81.        goto second;                                                   /* Jump to second */
82.
83.        }
84.
85.          else                                                         /* Judgment is false */
86.
87.        {
88.
89.          printf("Input the number of luckyegg\n");                   /* The prompt is displayed */
90.
91.          scanf("%d",&n_luckyegg);                                     /* Input the number of Luckyegg */
92.
93.          printf("The number of your luckyegg:%d.\n",n_luckyegg);      /* The prompt is displayed */
94.
95.        }
96.
97.        if(n_luckyegg==0)                                              /* To determine whether there are lucky eggs */
98.
99.        {
100.
101.          result2=calculate1(n_Candy);                                 /* Call the function to calculate the experience */
102.
103.          result3=calculate2(n_Pidgey,n_Candy);                        /* Call the function to calculate the experience */
104.
105.          result4=calculate3(n_Pidgey,n_Candy);                        /* Call the function, calculate the number of elves and the size of the first evolution */
106.
107.        printf("Getting experience:\n");                               /* The prompt is displayed */
108.
109.        if(result4>0)                                                  /* Determine if result4 is greater than zero */
110.
111.        {
112.
113.          printf("%d\n",result2);                                      /* The prompt is displayed */
114.
115.          }
116.
117.        else                                                           /* Judgment is false */
118.
119.        {
120.
121.          printf("%d\n",result3);                                      /* The prompt is displayed */
122.
123.        }
124.
125.          }
126.
127.           else                                                        /* Judgment is false */
128.        {
129.
130.          result5=calculate4(n_Candy);                                 /* Call the function to calculate the experience */
131.
132.          result6=calculate5(n_Pidgey,n_Candy);                        /* Call the function to calculate the experience */
133.
134.          result4=calculate3(n_Pidgey,n_Candy);
135.
136.        printf("Getting experience:\n");                               /* The prompt is displayed */
137.
138.        if(result4>0)                                                  /* Determine if result4 is greater than zero */
139.
140.        {
141.
142.          printf("%d\n",result5);                                      /* The prompt is displayed */
143.
144.          }
145.
146.        else                                                           /* Judgment is false */
147.
148.        {
149.
150.          printf("%d\n",result6);                                      /* The prompt is displayed */
151.
152.         }
153.
154.         }
155.
156.          return 0;                                                    /* Returns an integer of 0 */
157.
158. }
159.
160.
161. int calculate1(int Candy)                                                          /* Define the calculation&#65292;the first time the number of evolution is less than the number of elves gained experience */
162. {
163.
164.          int result2=Candy/Firstcandy*Experience;                                  /* Specific calculation, the number of the first evolution is less than the number of elves experience gained */
165.
166.          return result2;                                                           /* Returns the calculation experience */
167.
168. }
169.
170. int calculate2(int Pidgey, int Candy)                                              /* Define the calculation, the first time the number of evolution is greater than the number of elves gained experience */
171.
172. {
173.          int result7=Candy-Pidgey*Firstcandy;                                      /* Specific calculations, when the first evolution has been the number of candy remaining */
174.
175.        if(result7>=50)                                                             /* Determine whether a second evolution */
176.
177.          {
178.
179.          int result8=result7/Secondcandy;                                          /* Specific calculation, the number of second evolution */
180.
181.        int result9=Pidgey-result8;                                                 /* Specific calculation, the second evolution of the number and size of the relationship between the wizard */
182.
183.        if(result9>0)                                                               /* Determine the number of times of the second evolution and the size of the number of sprites */
184.
185.          {
186.
187.        int result3=result8*Experience+Pidgey*Experience;                           /* Specifically, when the second evolution of the number of times less than the number of elves for two evolutionary experience */
188.
189.        return result3;                                                             /* Returns the calculation experience */
190.
191.        }
192.
193.        else                                                                        /* Judgment is false */
194.
195.          {
196.
197.        int result3=(result8+result9)*Experience+Pidgey*Experience;                 /* Specifically, when the second evolution of the number of times greater than the number of elves for two evolutionary experience */
198.
199.        return result3;                                                             /* Returns the calculation experience */
200.
201.        }
202.
203.        }
204.
205.        else                                                                        /* Judgment is false */
206.
207.        {
208.
209.         int result3=Pidgey*Experience;                                             /* Specific calculation, the number of the first evolution is geater than the number of elves experience gained */
210.
211.          return result3;                                                           /* Returns the calculation experience */
212.
213.        }
214. }
215.
216. int calculate3(int Pidgey,int Candy)                                               /* Defines the relationship between the number of times the first evolution is counted and the number of sprites */
217.
218. {
219.         int result4=Pidgey-Candy/Firstcandy;                                       /* Specific calculation, the first evolution of the number of times and the size of the relationship between the wizard */
220.
221.         return result4;                                                            /* Returns the relationship between the number of times of the first evolution and the number of sprites */
222. }
223.
224. int calculate4(int Candy)                                                          /* Define the calculation&#65292;using luckyegg the first time the number of evolution is less than the number of elves gained experience */
225.
226. {
227.
228.          int result5=Candy/Firstcandy*Experience*Luckyegg;                         /* Specific calculation, usingthe number of the first evolution is less than the number of elves experience gained */
229.
230.          return result5;                                                           /* Returns the calculation experience */
231.
232. }
233.
234. int calculate5(int Pidgey,int Candy)                                               /* Define the calculation, using luckyegg the first time the number of evolution is greater than the number of elves gained experience */
235.
236. {
237.         int result7=Candy-Pidgey*Firstcandy;                                       /* Specific calculations, when the first evolution has been the number of candy remaining */
238.
239.        if(result7>=50)                                                             /* Determine whether a second evolution */
240.
241.          {
242.
243.          int result8=result7/Secondcandy;                                          /* Specific calculation, the number of second evolution */
244.
245.          int result9=Pidgey-result8;                                               /* Specific calculation, the second evolution of the number and size of the relationship between the wizard */
246.
247.        if(result9>0)                                                               /* Determine the number of times of the second evolution and the size of the number of sprites */
248.
249.          {
250.
251.        int result6=(result8*Experience+Pidgey*Experience)*Luckyegg;                /* Specifically, using luckyegg when the second evolution of the number of times less than the number of elves for two evolutionary experience */
252.
253.        return result6;                                                             /* Returns the calculation experience */
254.
255.        }
256.
257.        else                                                                        /* Judgment is false */
258.
259.          {
260.
261.        int result6=(((result8+result9)*Experience+Pidgey*Experience)*Luckyegg);    /* Specifically,using luckyegg when the second evolution of the number of times greater than the number of elves for two evolutionary experience */
262.
263.        return result6;                                                             /* Returns the calculation experience */
264.
265.        }
266.
267.        }
268.
269.        else                                                                         /* Judgment is false */
270.        {
271.
272.         int result6=Pidgey*Experience*Luckyegg;                                     /* Specific calculation, using luckyegg the number of the first evolution is geater than the number of elves experience gained */
273.
274.          return result6;                                                            /* Returns the calculation experience */
275.
276.        }
277.
278. }