something funny

something funny.

  1 #include <stdio.h>
  2 #include <windows.h>
  3 #define N 50
  4 HANDLE hConsole;
  5 void gotoxy(int x, int y)
  6 {
  7     COORD coord;
  8     coord.X = x;
  9     coord.Y = y;
 10     SetConsoleCursorPosition(hConsole, coord);
 11 }
 12 int main()
 13 {
 14     int i, j, k;
 15     hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
 16     SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
 17     for (k = 0; k<3; k++)
 18     {
 19         gotoxy(4, 6);
 20
 21         for (i = 0; i<11; i++)
 22
 23         {
 24             printf("*");
 25             Sleep(N);
 26
 27         }
 28
 29         for (i = 0; i<12; i++)
 30         {
 31             gotoxy(9, 7 + i);
 32             printf("*");
 33             Sleep(N);
 34         }
 35         gotoxy(4, 18);
 36         for (i = 0; i<11; i++)
 37         {
 38             printf("*");
 39             Sleep(N);
 40         }
 41         gotoxy(36, 10);
 42         printf("*");
 43         Sleep(N);
 44
 45         gotoxy(25, 10);
 46         printf("*");
 47         Sleep(N);
 48
 49         gotoxy(47, 10);
 50         printf("*");
 51         Sleep(N);
 52
 53         gotoxy(34, 8);
 54         printf("*");
 55         Sleep(N);
 56
 57         gotoxy(38, 8);
 58         printf("*");
 59         Sleep(N);
 60
 61         gotoxy(30, 7);
 62         printf("*");
 63         Sleep(N);
 64
 65         gotoxy(42, 7);
 66         printf("*");
 67         Sleep(N);
 68
 69         gotoxy(27, 8);
 70         printf("*");
 71         Sleep(N);
 72
 73         gotoxy(45, 8);
 74         printf("*");
 75         Sleep(N);
 76
 77         gotoxy(25, 11);
 78         printf("*");
 79         Sleep(N);
 80
 81         gotoxy(47, 11);
 82         printf("*");
 83         Sleep(N);
 84         for (i = 1, j = 1; i<6, j<6; i++, j++)
 85         {
 86             gotoxy(25 + i, 11 + j);
 87             printf("*");
 88             Sleep(N);
 89         }
 90         gotoxy(32, 17);
 91         printf("*");
 92         Sleep(N);
 93
 94         gotoxy(34, 18);
 95         printf("*");
 96         Sleep(N);
 97
 98
 99         for (i = 1, j = 1; i<6, j<6; i++, j++)
100         {
101             gotoxy(47 - i, 11 + j);
102             printf("*");
103             Sleep(N);
104         }
105         gotoxy(40, 17);
106         printf("*");
107         Sleep(N);
108
109         gotoxy(38, 18);
110         printf("*");
111         Sleep(N);
112
113         gotoxy(36, 19);
114         printf("*");
115         Sleep(N);
116         for (i = 0; i<11; i++)
117         {
118             gotoxy(59, 6 + i);
119             printf("*");
120             Sleep(N);
121         }
122         gotoxy(61, 17);
123         printf("*");
124         Sleep(N);
125         for (i = 0; i<11; i++)
126         {
127             gotoxy(63 + i, 18);
128             printf("*");
129             Sleep(N);
130         }
131         gotoxy(74, 17);
132         printf("*");
133         Sleep(N);
134
135         gotoxy(76, 16);
136         printf("*");
137         Sleep(N);
138         for (i = 0; i<10; i++)
139         {
140             gotoxy(76, 15 - i);
141             printf("*");
142             Sleep(N);
143         }
144         system("cls");
145     }
146     while (1)
147     {
148         gotoxy(4, 6);
149
150         for (i = 0; i<11; i++)
151
152         {
153             printf("*");
154
155
156         }
157
158         for (i = 0; i<12; i++)
159         {
160             gotoxy(9, 7 + i);
161             printf("*");
162
163         }
164         gotoxy(4, 18);
165         for (i = 0; i<11; i++)
166         {
167             printf("*");
168
169         }
170         gotoxy(36, 10);
171         printf("*");
172
173
174         gotoxy(25, 10);
175         printf("*");
176
177
178         gotoxy(47, 10);
179         printf("*");
180
181
182         gotoxy(34, 8);
183         printf("*");
184
185
186         gotoxy(38, 8);
187         printf("*");
188
189
190         gotoxy(30, 7);
191         printf("*");
192
193         gotoxy(42, 7);
194         printf("*");
195
196
197         gotoxy(27, 8);
198         printf("*");
199
200
201         gotoxy(45, 8);
202         printf("*");
203
204
205         gotoxy(25, 11);
206         printf("*");
207
208
209         gotoxy(47, 11);
210         printf("*");
211
212         for (i = 1, j = 1; i<6, j<6; i++, j++)
213         {
214             gotoxy(25 + i, 11 + j);
215             printf("*");
216
217         }
218         gotoxy(32, 17);
219         printf("*");
220
221
222         gotoxy(34, 18);
223         printf("*");
224
225
226
227         for (i = 1, j = 1; i<6, j<6; i++, j++)
228         {
229             gotoxy(47 - i, 11 + j);
230             printf("*");
231
232         }
233         gotoxy(40, 17);
234         printf("*");
235
236
237         gotoxy(38, 18);
238         printf("*");
239
240
241         gotoxy(36, 19);
242         printf("*");
243
244         for (i = 0; i<11; i++)
245         {
246             gotoxy(59, 6 + i);
247             printf("*");
248
249         }
250         gotoxy(61, 17);
251         printf("*");
252
253         for (i = 0; i<11; i++)
254         {
255             gotoxy(63 + i, 18);
256             printf("*");
257
258         }
259         gotoxy(74, 17);
260         printf("*");
261         Sleep(100);
262         gotoxy(76, 16);
263         printf("*");
264
265         for (i = 0; i<10; i++)
266         {
267             gotoxy(76, 15 - i);
268             printf("*");
269
270         }
271         gotoxy(25, 22);
272         Sleep(1000);
273         system("cls");
274     }
275 }
时间: 2024-10-29 19:07:14