0
0
彩色字体可以用:
void color(int ForgC, int BackC) { // 前景色,背景色
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
图形建议用dx2d或者opengl,非常复杂,不在此描述(简单的可以用easyx,缺点是不开源而且设计落后)
0
void color(int corcorcor) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),corcorcor);
}
颜色函数
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
int i,ss;
cout << " ";
for (i = 1; i <= 255; i++)
{
if (i <= 9) ss = 2 + 1;
else if (i >= 10 && i <= 99) ss = 2;
else ss = 1;
for (int j = 1; j < ss; j++)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), i);
cout << " ";
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), i);
cout << i;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0);
cout << " ";
if (i == 15) cout << endl;
else
{
if ((i+1) % 16 == 0 && i!=0)
{
cout << endl;
}
}
}
}
查看所有的颜色
图形要加上easyx.h库和graphics.h库
0