<mosaic.cnfolio.com>
PROGRAM
1. /* psuedo coode
2. START PROGRAM
3. ADD integers num 1
5. ADD guy 1
10. SCAN for num1
11. IF
12. Num1 is less than 2
13. Print please enter valaded amount fo cards
14. END IF
15. IF
16. Num1 is more than 10
17. PRINT please enter correct number of cards
18. ENF IF
19.
20. SET I to 0  I is less than number 1 add 1 to I
21. SCAN for guy 1 numbers
22.
23. IF
24. guy 1 and I is less than 1
25. PRINT enter a feasible number
26. END IF
27.
28. IF
29. Guy  is more than 10
30. PRINT please enter a feasible number
31. ENDIF
32. WHILE
33. Num2 is more than 1 and less than 11 scan for the numbers
34.
35. IF
36. Num2 is less than 2
37. Print please enter more cards
38. END IF
39.
40. IF
41. Num2 is more than 10
42. Print please enter less cards
43. END IF
44.
45. FOR set j to o j should be les than num 2 add 1 to j
46. SCAN for guys 2 numbers (j)
47. IF
48. Guy2(J) is less than 1 or more than 10
49. PRINT you have cards that are not vailid
50. END IF
51.
52. FOR set I to 0 when num 1 is is more than I -1 from it and pluss 1 to I
53. For set j to 0
54. J is less than num1 add 1 to j
55. IF guy1 and j+1 = guy1
56. SET it to temp
57. END IF
58.
59. FOR I=0 and is less than num2-1 add 1 to i
60. Set j to 0 and j= less than num2 add 1 to j
61. IF
62. Guy2 (J+1) is more than guy2 (j)
63. END IF
64. put guy2 in to temp
65. Guy2 (j) is = to guy2[j+1]
66. Set temp to guy 2 [j+1] to temp
67.
68. I=o and I is less than 10 add 1 to I
69. IF
70. num1  is equal to 0 and is the same as num2
71. print players draw
72. END IF
73.
74. IF
75. Num1 is equal to 0
76. Print player 2 wins
77. END IF
78.
79. IF
80. num2 is equal to 0
81. Print player 1 wins
82. END IF
83.
84. IF
85. guy1(i) is equal to guy 2 (i)
86. Print player both win and draw
87. END iF
88.
89. IF
90. Guy1 (i) is higher than guy 2
91. print well done player 1 wins
92. END IF
93. IF
94. Guy1(i) is lover than guy 2 (i)
95. Then print guy2 wins
96. END IF
97. Get rid of all data in num 1 rest to standard
98. Get rid of al data in num 2 rest to standard
99. END
100.
101. */
102.
103.
104.
105. #include <stdio.h>
106. #include <stdlib.h>
107.
108. int main(){
109.
110.     int num1=0;
111.     int num2=0;
112.     int guy1;
113.     int guy2;
114.     int i,j;
115.     int temp;
116.
117.     while(num1<1 || num1>11){
118.       scanf(" %d", &num1);
119.
120.       if(num1 < 2){
121.         printf("please enter a card value that is 2 or above  ");
122.         return 0;
123.       }
124.
125.       if(num1 > 10){
126.         printf("please enter corect nomerical  numbers between 1 and 10  ");
127.         return 0;
128.       }
129.
130.     }
131.
132.     for(i = 0;i<num1;i++){
133.         scanf(" %d", &guy1[i]);
134.           if(guy1[i]<1){
135.             printf("please enter more cards/ enter cards that do not conatin letters ");
136.             return 0;
137.
138.           }
139.           if(guy1[i]>10){
140.             printf("please enter a valed card number ");
141.             return 0;
142.             }
143.     }
144.
145.     while(num2<1 || num2>11){
146.       scanf(" %d", &num2);
147.
148.       if(num2 < 2){
149.         printf("please enter a valded amount fo cards ");
150.         return 0;
151.       }
152.
153.       if(num2 > 10){
154.         printf("please enter less cards ");
155.         return 0;
156.       }
157.     }
158.
159.     for(j = 0;j<num2;j++){
160.         scanf(" %d", &guy2[j]);
161.           if(guy2[j]<1 || guy2[j]>10){
162.             printf("please enter a valde number for the cards ");
163.             }
164.     }
165.
166.     for(i=0;i<num1-1;i++){
167.         for(j=0;j <num1;j++){
168.             if(guy1[j+1] > guy1[j]){
169.                 temp = guy1[j];
170.                 guy1[j] = guy1[j+1];
171.                 guy1[j+1] = temp;
172.
173.             }
174.         }
175.     }
176. for(i=0;i<num2-1;i++){
177.         for(j=0;j <num2;j++){
178.             if(guy2[j+1] > guy2[j]){
179.                 temp = guy2[j];
180.                 guy2[j] = guy2[j+1];
181.                 guy2[j+1] = temp;
182.
183.             }
184.         }
185.     }
186.
187.     for(i=0; i<10;i++){
188.         if(num1 == 0 && num2 == 0){
189.               printf("both player have the same cards over all result tie ");
190.               break;
191.         }
192.         if(num1 == 0){
193.               printf("well done player 2 wins ");
194.               break;
195.         }
196.         if(num2 == 0){
197.               printf("well done player 1 wins ");
198.              break;
199.         }
200.         if(guy1[i] == guy2[i]){
201.                  printf("both player win it is a draw");
202.               break;
203.         }
204.         if(guy1[i] > guy2[i]){
205.             printf("well done player 1 wins ");
206.             break;
207.         }
208.         if(guy1[i] < guy2[i]){
209.             printf("well done player 2 wins ");
210.             break;
211.
212.         }
213.         num1--;
214.         num2--;
215.     }
216.   return 0;
217. }