使用 C 图形绘制形状
2021-07-08 05:58:33
深夜i
--
--
使
用
形
绘
制
形
状
该 C 图形程序使用 C 图形绘制圆形、直线、矩形、椭圆等基本形状并在屏幕上显示文本。 这可以是初学者的第一个图形程序。
C程序
#include<graphics.h>
#include<conio.h>
main()
{
int gd = DETECT,gm,left=100,top=100,right=200,bottom=200,x= 300,y=150,radius=50;
initgraph(&gd, &gm, "C:\\TC\\BGI");
rectangle(left, top, right, bottom);
circle(x, y, radius);
bar(left + 300, top, right + 300, bottom);
line(left - 10, top + 150, left + 410, top + 150);
ellipse(x, y + 200, 0, 360, 100, 50);
outtextxy(left + 100, top + 325, "My first C graphics program");
getch();
closegraph();
return 0;
}
上一篇:
idea打包java可执行jar包
下一篇:
C程序绘制条形图
评论区