vc下如何使用textbackground()函数
在VC++中,可使用textbackground()函数来设置字符的背景色彩。
该函数的原型为:
void textbackground(int color);
其中,color参数表示需要设置的背景色彩,可以是以下常量之一:
例如,下面的代码可以将控制台中输出的字符的背景色彩设置为红色:
#include <conio.h>
int main() {
textbackground(RED);
cprintf("Hello, world!");
getch();
return 0;
}
运行此程序后,控制台中输出的字符的背景色彩将会变成红色。
TOP