<mosaic.cnfolio.com>
PROGRAM
1. /*START
2. Input player 1 and player 2 cards (2-10)
3.        Then
4. Sort cards for each player from highest to lowest
5.            Then
6. Each Players present it highest card
7. If player 1 has the highest card
8.     Then
9. Display Player 1 winner message
10. Else
11. Display player 2 winner message
12. If player 1 and 2 have the same card and show the next highest card
13. Else
14. If player runs out of cards
15.   Display the player  more in their hand winner message
16. Else
17. Players run out of cards
18. Display draw message
19. END*/
20.
21.
22. #include <stdio.h>
23. int main( void )
24. {
25.
26.    int sum;
27.    int card1[10];
28.    int card2[10];
29. scanf( "%d %d %d %d %d %d %d %d %d %d",&card1[0],card1[1],card1[2],card1[2],card1[3],card1[4],card1[5],card1[6],card1[7],card1[8],card1[9]);
30. scanf( "%d %d %d %d %d %d %d %d %d %d",&card2[0],card1[1],card1[2],card1[2],card1[3],card1[4],card1[5],card1[6],card1[7],card1[8],card1[9]);
31.
32.   sum = card1[0] - card2[0];
33.
34.   if (sum > 0)
35.   {
36.   printf ("Player 1 wins");
37.   }
38.
39.   else if (sum < 0)
40.   {
41.   printf ("Player 2 wins");
42.   }
43.
44.   else (sum == 0);
45.   {
46.   printf("Draw");
47.   }
48.
49. sum = card1[1] - card2[1];
50.
51.   if (sum > 0)
52.   {
53.   printf ("Player 1 wins");
54.   }
55.
56.   else if (sum < 0 )
57.   {
58.   printf("Player 2 wins");
59.   }
60.   else
61.   {
62.   printf( "Draw" );
63.   }
64.
65. sum = card1[2] - card2[2];
66.
67.   if (sum > 0)
68.   {
69.   printf ("Player 1 wins");
70.   }
71.
72.   else if (sum < 0)
73.   {
74.   printf ("Player 2 wins");
75.   }
76.
77.   else
78.   {
79.   printf( "Draw" );
80.   }
81.
82.
83. sum = card1[3] - card2[3];
84.
85.   if (sum > 0)
86.   {
87.   printf ("Player 1 wins");
88.   }
89.
90.   else if (sum < 0)
91.   {
92.   printf ("Player 2 wins");
93.   }
94.
95.   else //(sum == 0);
96.   {
97.   printf( "Draw" );
98.   }
99.
100. sum = card1[4] - card2[4];
101.
102.   if (sum > 0)
103.   {
104.   printf ("Player 1 wins");
105.   }
106.
107.   else if (sum < 0)
108.   {
109.   printf ("Player 2 wins");
110.   }
111.
112.   else
113.   {
114.   printf( "Draw" );
115.   }
116.
117.
118. sum = card1[5] - card2[5];
119.
120.   if (sum > 0)
121.   {
122.   printf ("Player 1 wins");
123.   }
124.
125.   else if (sum < 0)
126.   {
127.   printf ("Player 2 wins");
128.   }
129.
130.   else
131.   {
132.   printf( "Draw" );
133.   }
134.
135.   sum = card1[6] - card2[6];
136.
137.   if (sum > 0)
138.   {
139.   printf ("Player 1 wins");
140.   }
141.
142.   else if(sum < 0)
143.   {
144.   printf ("Player 2 wins");
145.   }
146.
147.   else
148.   {
149.   printf( "Draw" );
150.
151.   sum = card1[7] - card2[7];
152.
153.   if (sum > 0)
154.   {
155.   printf ("Player 1 wins");
156.   }
157.
158.   else if (sum < 0)
159.   {
160.   printf ("Player 2 wins");
161.   }
162.
163.   else
164.   {
165.   printf( "Draw" );
166.
167.   sum = card1[8] - card2[8];
168.
169.   if (sum > 0)
170.   {
171.   printf ("Player 1 wins");
172.   }
173.
174.   else if (sum < 0)
175.   {
176.   printf ("Player 2 wins");
177.   }
178.
179.   else
180.   {
181.   printf("Draw");
182.   }
183.  sum = card1[9] - card2[9];
184.
185.   if (sum > 0)
186.   {
187.   printf ("Player 1 wins");
188.   }
189.
190.   else if (sum < 0)
191.   {
192.   printf ("Player 2 wins");
193.   }
194.
195.   else
196.   {
197.   printf("Draw");
198.   }
199.  }
200.  }