注册 登录
编程论坛 Ubuntu

vt100背景颜色和字体颜色问题

菜鸟阿力 发布于 2016-05-01 08:07, 6473 次点击
各位大神,帮忙看看这段代码有何问题,为什么不能显示不同的颜色?
#include<stdio.h>
#include<string.h>

int main()
{
    int i;
    char *color[8] = {"black","dark red","green","yellow","blue","purple","dark green","white"};
    printf("press any key to change color\n");   
    for(i = 40;i <= 47;i++)
    {
        printf("\033[i;(i-10)m");
        printf("the color you have chosen is %s\n",color[i-40]);
        printf("\033[0m");
    }
    return 0;
}
0 回复
1