荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: golfong (8848), 信区: Program
标  题: BGI问题(附程序)
发信站: BBS 荔园晨风站 (Tue Mar 14 21:34:29 2000), 转信

//draw.cpp--Show you most of the simple drawing routing in the BGI.
//These do not include the fill routing or the various line styles
//that are available.
#include<graphics.h>
#include<conio.h>

main()
{
int gmode,maxx,gdriver=DETECT;
int points[10];
initgraph(&gdriver,&gmode,"\\BC5\\bgi");
maxx=getmaxx();maxy=getmaxy();
//Draw an arc,circle,and polygon on the top portion of the screen
//and an ellipse,line,and rectangle on the lower portion
arc(maxx/6,maxy/4,0,135,50);
outtextxy(maxx/6-textwidth("arc")/2,0,"arc");

circle(maxx/2,maxy/4,60);
outtextxy(maxx/2-textwidth("circle")/2,0,"circle");

points[0]=maxx*5/6-20;points[1]=maxy/4-20;
points[2]=maxx*5/6-30;points[3]=maxy/4+25;
points[4]=maxx*5/6+40;points[5]=maxy/4+15;
points[6]=maxx*5/6+20;points[7]=maxy/4-30;
points[8]=points[0];  points[9]=points[1];
drawpoly(5,points);
outtextxy(maxx*5/6-textwidth("drawpoly")/2,0,"drawpoly");

ellipse(maxx/6,maxy*3/4,0,360,75,20);
outtextxy(maxx/6-textwidth("ellipse")/2,maxy-textheight("1"),
"ellipse");

line(maxx/2-25,maxy*3/4-25,maxx/2+25,maxy*3/4+25);
outtextxy(maxx/2-textwidth("line")/2,maxy-textheight("1"),"line");

rectangle(maxx*5/6-30,maxx*3/4-20,maxx*5/6+30,maxy*3/4+20);
outtextxy(maxx*5/6-textwidth("retangle")/2,maxy-textheight("1"),
"rectangle");

getch();
closegraph();
return();
}
以上程序是用的B C++5。

--
※ 来源:·BBS 荔园晨风站 bbs.szu.edu.cn·[FROM: 192.168.1.53]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店