CTOE.CPP
资源名称:C++100.rar [点击查看]
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:2k
源码类别:
Windows编程
开发平台:
Visual C++
- #include<graphics.h>
- #include<conio.h>
- #include<dos.h>
- void CLR_C_E(void);
- void CLR_E_C(void);
- void DRAWPICTURE(void);
- void main()
- {
- int driver=DETECT,mode;
- registerbgidriver(EGAVGA_driver);
- initgraph(&driver,&mode,"");
- DRAWPICTURE();
- getch();
- CLR_C_E();
- setcolor(YELLOW);
- outtextxy(250,200,"Press any key to CONTINUE!");
- getch();
- DRAWPICTURE();
- getch();
- CLR_E_C();
- setcolor(YELLOW);
- outtextxy(250,200,"Press any key to EXIT!");
- getch();
- closegraph();
- }
- void DRAWPICTURE(void)
- {
- void DRAWCIRCLE(int X,int Y,int R,int COLOR);
- void DRAWANGLE(int X1,int Y1,int X2,int Y2,int X3,int Y3,int COLOR);
- bar(0,0,639,479);
- setfillstyle(1,LIGHTGRAY);
- floodfill(1,1,LIGHTGRAY);
- DRAWANGLE(50,20,450,150,550,30,WHITE);
- DRAWANGLE(70,80,200,150,290,90,RED);
- DRAWANGLE(100,170,230,160,300,190,11);
- DRAWANGLE(350,250,450,150,560,200,12);
- DRAWANGLE(50,300,160,260,390,480,RED);
- DRAWCIRCLE(200,350,80,RED);
- DRAWCIRCLE(450,100,80,13);
- DRAWCIRCLE(450,300,150,YELLOW);
- DRAWCIRCLE(100,150,100,BLUE);
- }
- void DRAWANGLE(int X1,int Y1,int X2,int Y2,int X3,int Y3,int COLOR)
- {
- int DATAARRAY[8];
- DATAARRAY[0]=X1;
- DATAARRAY[1]=Y1;
- DATAARRAY[2]=X2;
- DATAARRAY[3]=Y2;
- DATAARRAY[4]=X3;
- DATAARRAY[5]=Y3;
- DATAARRAY[6]=X1;
- DATAARRAY[7]=Y1;
- setcolor(COLOR);
- drawpoly(4,DATAARRAY);
- }
- void DRAWCIRCLE(int X,int Y,int R,int COLOR)
- {
- setcolor(COLOR);
- circle(X,Y,R);
- setfillstyle(1,COLOR);
- floodfill(X,Y,COLOR);
- }
- void CLR_C_E(void)
- {
- int NUM;
- setcolor(BLACK);
- for(NUM=319;NUM>=0;NUM--)
- {
- line(NUM,0,NUM,479);
- line(639-NUM,0,639-NUM,479);
- delay(2);
- }
- }
- void CLR_E_C(void)
- {
- int NUM;
- setcolor(BLACK);
- for(NUM=0;NUM<=319;NUM++)
- {
- line(NUM,0,NUM,479);
- line(639-NUM,0,639-NUM,479);
- delay(2);
- }
- }