New Beginnings C language <graphics.h>

Further contacting the C language <graphics.h>

 1 #include<stdio.h>
 2 #include<graphics.h>
 3 #include<conio.h>
 4 int main() {
 5     int x = 0, y = 0;
 6     initgraph(800, 800);
 7     IMAGE img;
 8     loadimage(&img, "9.jpg", 80, 80);
 9     putimage(x, y, &img);
10     while (1) {
11         switch (getchar()) {
12         case 'w': y = y - 10; break;
13         case 'a': x = x - 10; break;
14         case 's': y = y + 10; break;
15         case 'd': y = y + 10; break;
16         }
17         cleardevice();
18         putimage(x, y, &img);
19     }
20 }
21 //

To be continued!

Guess you like

Origin www.cnblogs.com/ouyangbo12/p/12163738.html