/*1-1.c*/
#include "graphics.h"
main( )
{
int gdriver, gmode;
detectgraph(&gdriver, &gmode); /*自动测试硬件*/
printf("driver is %d, mode is %d\n", gdriver,gmode); /*输出测试结果*/
getch();
initgraph(&gdriver, &gmode, ""); /* 根据测试结果初始化图形*/
circle(320,240,50);
circle(320,240,80);
circle(320,240,110);
getch();
closegraph();
}
/*1-2.c*/
#include "graphics.h"
main()
{
int gdriver=DETECT, gmode;
initgraph(&gdriver, &gmode, "");
circle(320,240,50);
circle(320,240,80);
circle(320,240,110);
getch();
closegraph();
}
/*1-3.c*/
#include "stdio.h"
#include "graphics.h"
main()
{
int gdriver, gmode, i,j;
gdriver=DETECT;
initgraph(&gdriver, &gmode, ""); /*图形初始化*/
setbkcolor(0); /*设置图形背景*/
cleardevice();
for(i=0; i<=15; i++)
{
setcolor(i); /*设置不同作图色*/
circle(319, 239, 20+i*15); /*画半径不同的圆*/
delay(3000); /*延迟3000毫秒*/
}
for(i=0; i<=15; i++)
{
setbkcolor(i); /*设置不同背景色*/
cleardevice();
for(j=0; j<=15;j++)
{
setcolor(j); /*设置不同作图色*/
circle(319, 239, 20+j*15); /*画半径不同的圆*/
delay(3000);
}
}
getch();
closegraph();
}
/*1-4.c*/
#include "stdlib.h"
#include "graphics.h"
main()
{
int gdriver=DETECT, gmode, i;
initgraph(&gdriver, &gmode, "");
setbkcolor(RED);
cleardevice();
setcolor(BLUE);
circle(320,240,50);
circle(320,240,100);
setlinestyle(0, 0, 3); /*设置三点宽实线*/
setcolor(2);
rectangle(220, 140, 420, 340);
setcolor(WHITE);
setlinestyle(4, 0xaaaa, 1); /*设置一点宽用户定义线*/
line(220, 240, 420, 240);
line(320, 140, 320, 340);
getch();
closegraph();
}
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |