希布伦学院留学费用:c语言编程程序

来源:百度文库 编辑:高考问答 时间:2024/04/28 02:59:57
编个程序,能运行出图形,最好不要太复杂
例如;椭圆,五角星

//TC2.0画椭圆
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int stangle = 0, endangle = 360;
int xradius = 100, yradius = 50;
initgraph(&gdriver, &gmode, );
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s
",
grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());
ellipse(midx, midy, stangle, endangle,xradius, yradius);
getch();
closegraph();
return 0;
}

graphics.h 你学一下吧,很好玩的

用graphics.h这个头函数包含的图形模式可以画出很多有趣的图形,还可以做游戏。

这个够简单,呵呵!(也很漂亮)
#include "stdio.h"
#include "graphics.h"
#include "conio.h"
main()
{
int x=360,y=160,driver=VGA,mode=VGAHI;
int num=20,i;
int top,bottom;
initgraph(&driver,&mode,"");
top=y-30;
bottom=y-30;
for(i=0;i<num;i++)
{
ellipse(250,250,0,360,top,bottom);
top-=5;
bottom+=5;
}
getch();
}

多有了