更新时间:2023-01-27 20:35:42
没有(标准)跨平台的方法来做到这一点。在Windows上,尝试使用 conio.h
。
它有:
textcolor(); // and
textbackground();
功能。
/ p>
textcolor(RED)
cprintf(H);
textcolor(BLUE);
cprintf(e);
//等等。
I want every character to be a different color.
for example,
cout << "Hello world" << endl;
I know this can be done, I just don't know the code for it.
and I want to change the background color to white. How would I do that?
There is no (standard) cross-platform way to do this. On windows, try using conio.h
.
It has the:
textcolor(); // and
textbackground();
functions.
For example:
textcolor(RED);
cprintf("H");
textcolor(BLUE);
cprintf("e");
// and so on.