专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »C语言教程 » c语言图形界面:用C语言编的图形界面应用程序 »正文

c语言图形界面:用C语言编的图形界面应用程序

来源: 发布时间:星期四, 2009年2月12日 浏览:261次 评论:0


#<conio.h>
#<stdlib.h>
# \"stdio.h\"
# \"graphics.h\"
# \"math.h\"
donghua
{ graphdriver=VGA;
graphmode=VGAHI;
i,j;
initgraph(&graphdriver,&graphmode,\"\");
cleardevice;
/************wan nian li*************************/
for(i=0;i<=150;i5)
{color(i);
textbackground(RED);
textstyle(0,0,5);
outtextxy(100,i+140,\"Wan Nian Li\");
delay(10000000);
cleardevice;
}
color(RED);
outtextxy(50,200,\"Loading\");
delay(100000000000);
outtextxy(50,200,\"Loading.\");
delay(100000000000);
outtextxy(50,200,\"Loading..\");
delay(100000000000);
outtextxy(50,200,\"Loading...\");
delay(100000000000);
outtextxy(50,200,\"Loading....\");
delay(100000000000);
outtextxy(50,200,\"Loading.....\");
delay(100000000000);
outtextxy(50,200,\"Loading......\");
delay(100000000000);
outtextxy(50,200,\"Loading.......\");
delay(100000000000);
outtextxy(50,200,\"Loading........\");
delay(100000000000);
outtextxy(50,200,\"Loading.........\");
delay(100000000000);
outtextxy(50,200,\"Loading..........\");
delay(100000000000);
outtextxy(50,200,\"Loading...........\");
outtextxy(50,200,\"Loading............\");
delay(100000000000);
for(i=0;i<=10;i)
delay(100000000000);
cleardevice;
/*********************prf color*************************/
for(i=0;i<=15;i) /*15 color of kind*/
{
bkcolor(i+1);
color(i);
fillstyle(1,i+1);
for(j=0;j<=600;j)
{delay(1000);
circle(320,240,j);
floodfill(320,240,i);
}
}
}
/*************menu**********************/
void menu
{ i,j;
cleardevice;
bkcolor(GREEN);
for(i=0;i<=100;i)
{delay(1000);
for(j=0;j<=10;j)
{fillstyle(1,LIGHTGREEN);
color(BROWN);
circle(320,240,i);
floodfill(320,240,BROWN);}
}
for(i=0;i<=70;i)
{delay(1000);
for(j=0;j<=20;j)
{fillstyle(1,RED);
color(RED);
circle(220,100,i);
floodfill(220,100,RED);}
}
color(YELLOW);
textstyle(3,0,5);
outtextxy(190,75,\"Run\");
for(i=0;i<=70;i)
{delay(1000);
for(j=0;j<=20;j)
{fillstyle(1,BLUE);
color(BLUE);
circle(420,100,i);
floodfill(420,100,BLUE);}
}
color(RED);
textstyle(3,0,5);
outtextxy(375,75,\"Game\");

for(i=0;i<=70;i)
{delay(1000);
for(j=0;j<=20;j)
{fillstyle(1,LIGHTBLUE);
color(LIGHTBLUE);
circle(220,380,i);
floodfill(220,380,LIGHTBLUE);}
}
color(RED);
textstyle(3,0,5);
outtextxy(165,360,\"Me\");

for(i=0;i<=70;i)
{delay(1000);
for(j=0;j<=20;j)
{fillstyle(1,LIGHTRED);
color(LIGHTRED);
circle(420,380,i);
floodfill(420,380,LIGHTRED);}
}
color(YELLOW);
textstyle(3,0,5);
outtextxy(390,360,\"Exit\");
color(BLUE);
textstyle(3,0,6);
delay(1500000);
outtextxy(280,210,\"Help\");
/***********draw line*******************/
for(i=130;i<=500;i)
{for(j=0;j<=100;j)
delay(10);
color(BLUE);
line(130,20,i,20);
delay(10);
line(128,18,i+2,18);
}
for(i=20;i<=460;i)
{for(j=0;j<=100;j)
delay(10);
color(BLUE);
line(500,20,500,i);
delay(10);
line(502,18,502,i+2);
}
for(i=500;i>=130;i--)
{for(j=100;j>=0;j--)
delay(10);
color(BLUE);
line(500,460,i,460);
delay(10);
line(502,462,i-2,462);
}
for(i=460;i>=20;i--)
{for(j=100;j>=0;j--)
delay(10);
color(BLUE);


line(130,460,130,i);
delay(10);
line(128,462,128,i-2);
}
/*************wan nian li*****************************/
color(RED);
textstyle(0,0,4);
for(j=15;j>=0;j-=2)
{delay(1000000);
outtextxy(j+10,j+50,\"Wan\");
}
for(j=15;j>=0;j-=2)
{delay(1000000);
outtextxy(j,j+200,\"Nian\");
}
for(j=15;j>=0;j-=2)
{delay(1000000);
outtextxy(j+10,j+350,\"Li\");
}
getch;
}
/**************************************/
bofangdonghua
{ graphdriver=VGA;
graphmode=VGAHI;
i,j;
char c;
initgraph(&graphdriver,&graphmode,\"\");
/*************shi fou bo fang dong hua?**************/
prf:{color(RED);
textstyle(3,0,5);
outtextxy(100,30,\"bo fang dong hua?\");
outtextxy(150,80,\"Yes\");
outtextxy(300,80,\"No\");
c=getch;
(c\'Y\'||c\'y\')
{donghua;
menu;
}

(c\'N\'||c\'n\')
menu;

{color(GREEN);
textstyle(3,0,8);
outtextxy(200,240,\"Error!\");
delay(10000000000);
cleardevice;
goto prf;
}
}
/**************************************/

}

{ graphdriver=VGA;
graphmode=VGAHI;
char c;
initgraph(&graphdriver,&graphmode,\"\");
bofangdonghua;
c=getch;
while(c!=\'e\'&&c!=\'E\')
{(c\'r\'||c\'R\')
run;
(c\'G\'||c\'g\')
game;
(c\'m\'||c\'M\')
about;
(c\'H\'||c\'h\')
help;
{
textstyle(3,1,6);
delay(10000000000);
outtextxy(530,240,\"ERROR!\");
}
c=getch; }
end;}
game
{cleardevice;
bkcolor(BLACK);
color(RED);
textstyle(3,0,5);
bar3d(10,10,600,500,2,1);
outtextxy(100,210,\"Sorry,it\'s mading!!\");
color(WHITE);
textstyle(3,0,3);
outtextxy(300,450,\"press any key to menu!!\");
getch;
jingzhimenu;
}
run
{ graphdriver=VGA;
graphmode=VGAHI;
i;
day;
year;
temp;
temp_i;
long Year_days = 0;
Year_Start = 1;
Per_Year_Days;
month_day={31,28,31,30,31,30,31,31,30,31,30,31,29};
initgraph(&graphdriver,&graphmode,\"\");
cleardevice;
bkcolor(BLACK);
prf(\"Please enter the year: \");
scanf(\"%d\",&year);

while(Year_Start < year)
{
( IsLeapYear( Year_Start ) )
Per_Year_Days = 366;

Per_Year_Days = 365;

Year_days = Year_days + Per_Year_Days;
Year_Start;
}

for( temp = 1; temp <=12; temp )
{
switch( temp )
{
1:
prf(\" January(%d)\\n\",year);
;
2:
prf(\" February(%d)\\n\",year);
;
3:
prf(\" March(%d)\\n\",year);
;
4:
prf(\" April(%d)\\n\",year);
;
5:
prf(\" May(%d)\\n\",year);
;
6:
prf(\" June(%d)\\n\",year);
;
7:
prf(\" July(%d)\\n\",year);
;
8:
prf(\" August(%d)\\n\",year);
;
9:
prf(\" September(%d)\\n\",year);
;
10:
prf(\" October(%d)\\n\",year);
;
11:
prf(\" November(%d)\\n\",year);
;
12:
prf(\" December(%d)\\n\",year);


;
}
i = Year_days % 7;
prf(\"Sun Mon Tue Wed Thu Fri Sat \\n\");
( i != 0 )
for( temp_i = 0; temp_i < i; temp_i)
prf(\" \");
day = 1;
( IsLeapYear(year) && temp 2)
while( day <= month_day[12] )
{
( day >1 )
( Year_days % 7 0 )
prf(\"\\n\");
( day >= 10 )
prf(\"%d \",day);

prf(\"%d \",day);
Year_days;
day;
}


while (day <= month_day[temp-1])
{
( day > 1 )
( Year_days % 7 0 )
prf(\"\\n\");
( day >=10 )
prf(\"%d \",day);

prf(\"%d \",day);
Year_days;
day;
}
prf(\"\\n\");
( getch \'q\' )
exit(0);
}
getch;
jingzhimenu;
}


IsLeapYear( year )
{
((year %4 0) && (year % 100 != 0) ||
(year % 400 0) )
1;

0;

}
help
{ gdriver=DETECT,gmode,i,n;
float t,x[6],y[6],a[5],b[5];
initgraph(&gdriver,&gmode,\"c:\\\\tc\");
cleardevice;
hua;
bkcolor(BLUE);
color(YELLOW);
textstyle(3,0,3);
outtextxy(100,200,\"press \'r\'or\'R\'----run\");
outtextxy(100,300,\"press \'G\'or\'g\'-----game\");
outtextxy(100,400,\"press \'m\'or\'M-----about me\'\");
outtextxy(100,480,\"press \'e\'or\'E\'----exit\");
color(RED);
outtextxy(100,100,\"press any key to menu!!\");
getch;
jingzhimenu;
}
hua2( x, y)
{ graphdriver=VGA;
graphmode=VGAHI;
register i;
initgraph(&graphdriver,&graphmode,\"\");
color(12);
arc(x+65,y-60,150,350,8);
arc(x+66,y-54,300,470,8);
arc(x+65,y-56,30,230,10);
arc(x+64,y-57,300,460,17);
ellipse(x+73,y-30,250,450,27,40);
ellipse(x+59,y-30,100,290,27,40);
ellipse(x+65,y-40,140,270,20,30);
fillstyle(SOLID_FILL,5);
floodfill(x+65,y-20,12);
arc(x,y,150,350,12);
arc(x+1,y+8,280,470,12);
arc(x,y+2,30,230,16);
arc(x,y+3,80,240,28);
arc(x+2,y+8,180,330,22);
arc(x-2,y+2,310,460,25);
ellipse(x-12,y+30,120,300,30,40);
ellipse(x+10,y+28,250,423,30,42);
ellipse(x-4,y+10,290,393,30,40);
fillstyle(SOLID_FILL,4);
floodfill(x+5,y+31,12);
ellipse(x+120,y+5,0,360,15,25);
fillstyle(SOLID_FILL,15);
floodfill(x+120,y,12);
ellipse(x-70,y+10,0,360,14,20);
fillstyle(SOLID_FILL,14);
floodfill(x-70,y+10,12);
color(10);
ellipse(x-15,y+32,190,310,30,35);
ellipse(x+16,y+32,235,355,26,35);
ellipse(x,y+35,190,350,43,50);
arc(x,y+82,190,350,6);
fillstyle(SOLID_FILL,2);
floodfill(x,y+75,10);
ellipse(x+50,y-48,190,320,22,50);
ellipse(x+80,y-48,220,350,22,50);
ellipse(x+65,y-28,180,360,36,50);
floodfill(x+65,y+18,10);
for(i=0;i<3;i)
{
ellipse(x-98,y+100+i,255,371,100,80);
ellipse(x-20,y+30+i,260,358,140,140);
ellipse(x+233,y+20+i,180,218,160,140);
}
ellipse(x+70,y+34,180,233,140,140);
ellipse(x,y+40,205,255,100,120);
ellipse(x+135,y-30,209,249,72,120);
ellipse(x,y+20,263,301,100,120);
ellipse(x+85,y-10,278,305,100,120);
ellipse(x+100,y-62,282,308,90,120);
ellipse(x-50,y-10,277,314,30,120);
ellipse(x+70,y+80,222,266,52,120);
ellipse(x-60,y-45,229,266,52,120);
ellipse(x+79,y-45,229,266,52,120);
ellipse(x+84,y,224,273,52,120);
ellipse(x+110,y+40,240,282,100,120);
ellipse(x+120,y-6,200,340,17,25);
ellipse(x+120,y+7,160,380,17,27);
ellipse(x-70,y+15,140,380,17,20);
}
hua
{ graphdriver=VGA;
graphmode=VGAHI;
initgraph(&graphdriver,&graphmode,\"\");
cleardevice;
hua2(480,90);
color(10);
rectangle(0,0,639,479);
}
about
{cleardevice;
bkcolor(BLUE);
color(GREEN);
textstyle(3,0,3);
outtextxy(10,100,\"My English name is Kemble\");
outtextxy(10,150,\"My homepage http://www.kemble0673.533.net\");
outtextxy(10,200,\"glad to meet you!!\");


outtextxy(300,400,\"press any key to menu!\");
getch;
jingzhimenu;
}
end
{ i;
for(i=0;i<=15;i)
{cleardevice;
color(i);
color(i);
textstyle(3,0,i-5);
outtextxy(20,200,\"Happy evrey day!!\");
delay(10000000000);
}

outtextxy(100,200,\"Bye.......\");
cleardevice;
for(i=0;i<=25;i)
delay(1000000000000);
outtextxy(100,200,\"Bye.......\");
closegraph;}

jingzhimenu
{ graphdriver=VGA;
graphmode=VGAHI;
initgraph(&graphdriver,&graphmode,\"\");
cleardevice;
bkcolor(GREEN);
fillstyle(1,LIGHTGREEN);
color(BROWN);
circle(320,240,100);
floodfill(320,240,BROWN);
fillstyle(1,RED);
color(RED);
circle(220,100,70);
floodfill(220,100,RED);
color(YELLOW);
textstyle(3,0,5);
outtextxy(190,75,\"Run\");
fillstyle(1,BLUE);
color(BLUE);
circle(420,100,70);
floodfill(420,100,BLUE);

color(RED);
textstyle(3,0,5);
outtextxy(375,75,\"Game\");
fillstyle(1,LIGHTBLUE);
color(LIGHTBLUE);
circle(220,380,70);
floodfill(220,380,LIGHTBLUE);
color(RED);
textstyle(3,0,5);
outtextxy(165,360,\"Me\");
fillstyle(1,LIGHTRED);
color(LIGHTRED);
circle(420,380,70);
floodfill(420,380,LIGHTRED);
color(YELLOW);
textstyle(3,0,5);
outtextxy(390,360,\"Exit\");
color(BLUE);
textstyle(3,0,6);
outtextxy(280,210,\"Help\");
line(130,20,500,20);
delay(10);
line(128,18,502,18);
line(500,20,500,460);
delay(10);
line(502,18,502,462);
line(500,460,130,460);
delay(10);
line(502,462,128,462);
line(130,460,130,20);
delay(10);
line(128,462,128,18);
color(RED);
textstyle(3,0,6);
outtextxy(10,50,\"wan\");
outtextxy(10,240,\"nian\");
outtextxy(50,380,\"li\");
}


0

相关文章

读者评论

发表评论

  • 昵称:
  • 内容: