/* WIN-TC BGI 图形编程模板 */
#include "Conio.h"
#include "graphics.h"
#include "math.h"
#include "stdio.h"
#define closegr closegraph
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0; /* 和gd = VGA,gm = VGAHI是同样效果 */
registerbgidriver(EGAVGA_driver);/* 注册BGI驱动后可以不需要.BGI文件的支持运行 */
initgraph(&gd, &gm, "");
}
int main(void)
{
setbkcolor(BLUE);
printf("/n/n/n/n/n/n/n//n/t/t/t/t/tHello,dajie!");
getch();
int a,b;float c;
initgr(); /* BGI初始化 */
a=rand()%360;b=0;
c=3.1415926*a/180 ;
while(1)
{
setcolor(rand()%16);
line(320,240,320+rand()%200*cos(c),240-rand()%200sin(c) );
b++;
if(b>10000) break;
}
printf("byebye!");
getch(); /* 暂停一下,看看前面绘图代码的运行结果 */
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
}