分类：教育/科学-理工学科-工程技术科学
问题：用c语言编一个小游戏 
回答：#include "std.h"#include "graphics.h"#include "conio.h"#include "stdlib.h"#include "math.h"void initgr(void){     int gd=DETECT,gm;     registerbgidriver(EGAVGA_driver);     initgraph(&gd,&gm,"");}int x1=200,y1=100;char accept,*p,*q;int *you;void  turn_right(char accept);void  turn_left(char accept) ;void  turn_down(char accept) ;void  change();void main(){     int i;     int polygon1[18],polygon2[18],polygon3[18],polygon4[18];       /*第一方块*/     polygon1[0]=x1;     polygon1[1]=y1;     polygon1[2]=x1+30;     polygon1[3]=y1;     polygon1[4]=x1+30;     polygon1[5]=y1+10;     polygon1[6]=x1+20;     polygon1[7]=y1+10;     polygon1[8]=x1+20;     polygon1[9]=y1+20;     polygon1[10]=x1+10;     polygon1[11]=y1+20;     polygon1[12]=x1+10;     polygon1[13]=y1+10;     polygon1[14]=x1;     polygon1[15]=y1+10;     polygon1[16]=x1;     polygon1[17]=y1;        /*第二方块*/     polygon2[0]=x1+10;     polygon2[1]=y1;     polygon2[2]=x1+20;     polygon2[3]=y1;     polygon2[4]=x1+20;     polygon2[5]=y1+30;     polygon2[6]=x1+10;     polygon2[7]=y1+30;     polygon2[8]=x1+10;     polygon2[9]=y1+20;     polygon2[10]=x1;     polygon2[11]=y1+20;     polygon2[12]=x1;     polygon2[13]=y1+10;     polygon2[14]=x1+10;     polygon2[15]=y1+10;     polygon2[16]=x1+10;     polygon2[17]=y1;     you=polygon2;     initgr();       /*设置方块*/     setcolor(RED);     setbkcolor(8);     setfillstyle(1,RED);     drawpoly(9,polygon2);     floodfill(x1+14,y1+14,RED);     setcolor(14);     drawpoly(9,polygon2);       /*把方块信息载入*/     p=malloc(imagesize(x1,y1,x1+30,y1+20));             /*enter=13*/     getimage(x1,y1,x1+30,y1+30,p);       /*接受字符判断和实现方块的具体移动*/     accept=getch();     while(accept!='*'){           if(accept=='d'||accept=='D')              turn_right(accept);           else if(accept=='a'||accept=='A')              turn_left(accept);           else if(accept=='s'||accept=='S')              turn_down(accept);           accept=getch();          /* if(accept==13) change();  */     }       /*结束函数*/     closegraph();}void  turn_right(char accept) /*把方块向右移动*/{      while(accept=='d'||accept=='D'){           putimage(x1,y1,p,1);           x1+=10;           putimage(x1,y1,p,1);           accept=getch();          /* if(accept==13) change();     */           delay(100000000000000000000000000);     }}void turn_left(char accept)   /*把方块向左移动*/{     while(accept=='a'||accept=='A'){           putimage(x1,y1,p,1);           x1-=10;           putimage(x1,y1,p,1);           accept=getch();          /* if(accept==13) change();    */           delay(100000000000000000000000000);     }}void turn_down(char accept)   /*把方块向下移动*/{     while(accept=='s'||accept=='S'){           putimage(x1,y1,p,1);           y1+=3;           putimage(x1,y1,p,1);           accept=getch();         /*  if(accept==13) change();      */           delay(1000000);     }}/*void change(){     setcolor(8);     setfillstyle(1,8);     rectangle(x1,y1,x1+30,y1+30);     floodfill(x1+15,y1+15,8);     setcolor(RED);     setbkcolor(8);     setfillstyle(1,RED);     drawpoly(9,you);     floodfill(x1+14,y1+14,RED);     setcolor(14);     drawpoly(9,you);     p=malloc(imagesize(x1,y1,x1+30,y1+20));     getimage(x1,y1,x1+30,y1+30,p);}                                                   */