输出有误
以下程序我用TC2.0编译通过,但是运行时出现以下错误:BGI error:graphics not initialized(use "initgraph")#include<graphics.h>
#include<stdio.h>
int main()
{
int i, gdriver, gmode;
char s[30];
gdriver=DETECT;
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
setbkcolor(BLUE);
cleardevice();
setviewport(100, 100, 540, 380, 1);
/*定义一个图形窗口*/
setfillstyle(1, 2); /*绿色以实填充*/
setcolor(YELLOW);
rectangle(0, 0, 439, 279);
floodfill(50, 50, 14);
setcolor(12);
settextstyle(1, 0, 8);
/*三重笔划字体, 水平放大8倍*/
outtextxy(20, 20, "Good Better");
setcolor(15);
settextstyle(3, 0, 5);
/*无衬笔划字体, 水平放大5倍*/
outtextxy(120, 120, "Good Better");
setcolor(14);
settextstyle(2, 0, 8);
i=620;
sprintf(s, "Your score is %d", i);
/*将数字转化为字符串*/
outtextxy(30, 200, s);
/*指定位置输出字符串*/
setcolor(1);
settextstyle(4, 0, 3);
outtextxy(70, 240, s);
getch();
closegraph();
return 0;
}