21xrx.com
2024-03-29 09:26:09 Friday
登录
文章检索 我的文章 写文章
使用 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;
}

 

  
  

评论区

{{item['qq_nickname']}}
()
回复
回复