|
5啊哈币
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- int main()
- {
- system("color 0a");
- char a[50][50]={" ###",
- " #*#",
- " # #",
- "####O######",
- "#* OS O *#",
- "#####O#####",
- " # # ",
- " #*# ",
- " ### ",};
- int i,x,y,p,q,h,g,c,d,e,f;
- char ch;
- x=4;y=5;
- p=3;q=4;
- h=4;g=4;
- c=4;d=7;
- e=5;f=5;
- for(i=0;i<=8;i++)
- {
- puts(a[i]);
- }
- while(1)
- {
- ch=getch();
- if(ch=='s')
- {
- if(a[x+1][y]!='#')
- {
- a[x][y]=' ';
- x++;
- a[x][y]='S';
- }
- if(a[e+1][f]!='O')
- {
- a[e][f]='S';
- e++;
- a[e][f]='O';
- }
-
- if(a[e+2][f]=='*')
- {
- a[e][f]='S';
- e++;
- a[e][f]='O';
- }
- }
-
- if(ch=='a')
- {
- if(a[x][y-1]!='#')
- {
- a[x][y]=' ';
- y--;
- a[x][y]='S';
- }
- if(a[h][g-1]!='O')
- {
- a[h][g]='S';
- g--;
- a[h][g]='O';
- }
- if(a[h][g-2]=='*')
- {
- a[h][g]='S';
- g--;
- a[h][g]='O';
- }
- }
-
- system("cls");
- for(i=0;i<=8;i++)
- {
- puts(a[i]);
- }
- }
- Sleep(5000);
- return 0;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
复制代码 |
|