用 system() 函数调 DOS 的 START, CMD, COLOR 三个命令组合就可实现。
程序核心语句如下。
char str_cmd[60];
int i;
for (i=1;i<8;i++)
{
sprintf(str_cmd,"start cmd /K color %d ",i);
system(str_cmd);
}
颜色
1 = 蓝 2 = 绿 3 = Aqua 湖蓝
4 = Red 红 5 = Purple 紫红 6 = 黄色
7 = 白色 8 = 灰色