简单的C语言问题,编译没通过,为什么?

来源:百度知道 编辑:UC知道 时间:2024/05/10 10:25:45
/*题目:Press any key to change color,
do you want to try it. Please hurry up! */
#include <conio.h>
void main(void)
{
int color;
for(color=0;color<8;color++)
{
textbackground(color);/*设置文本的背景颜色*/
cprintf("This is color %d\r\n",color);
cprintf("Press any key to continue\r\n");
getch();/*输入字符看不见*/
}
getch();
}

textbackground()属于graphics.h需要
#include "graphics.h"
然后对图形设备初始化
initgraph(...);
对显示设备初始化
具体的网上查查

你用什么编译器?这个是在TC下的代码,VC中没有textbackground
这个函数,要自己写