(求助)图形程序问题
#include <graphics.h>main()
{
int gdriver,gmode,i;
gdriver=DETECT;
registerbgidriver(EGAVGA_driver);
initgraph(&gdriver,&gmode,"");
setbkcolor(0);
cleardevice();
for (i=0;i<15;i++);
{
setbkcolor(i);
circle(320,240,20+i*10);
delay(100);
}
for (i=0;i<15;i++)
{
cleardevice();
setcolor(i);
circle(320,240,20+i*10);
delay(100);
}
closegraph();
return 0;
}
当我运行完这个程序的时候怎么不能正常退出,总是黑屏,但没死机,就是看不到屏幕
----------------解决方案--------------------------------------------------------
结尾加上exit(1);
----------------解决方案--------------------------------------------------------
#include<stdio.h>
#include<graphics.h>
int main()
{
int gdriver, gmode, i;
gdriver=DETECT;
registerbgidriver(EGAVGA_driver);/*建立独立图形运行程序*/
initgraph(&gdriver, &gmode, "");/*图形初始化*/
setbkcolor(0); /*设置图形背景*/
cleardevice();
for(i=0; i<=15; i++)
{
setcolor(i); /*设置不同作图色*/
circle(320, 240, 20+i*10); /*画半径不同的圆*/
getch();
}
for(i=0; i<=15; i++)
{
setbkcolor(i); /*设置不同背景色*/
cleardevice();
circle(320, 240, 20+i*10);
getch();
}
closegraph();
return 0;
}
----------------解决方案--------------------------------------------------------
我觉得registerbgidriver()没必要
----------------解决方案--------------------------------------------------------
注意initgraph()路径是否正确
----------------解决方案--------------------------------------------------------