如何给输出字体加颜色啊
怎么样是输出的字体有颜色啊?例如:
#include"stdio.h"
int main()
{
printf("我是菜鸟,想请教各位高手\n");
return 0;
}
我用的是vc6.0编译器~~ 我想要把“我是菜鸟,想请教各位高手”这些字改成其他颜色或者是闪字,
怎么弄啊?
最好给出代码。谢谢
#include <iostream> #include <Windows.h> using namespace std; int main() { HANDLE hHandle = ::GetStdHandle( STD_OUTPUT_HANDLE ); if( hHandle == INVALID_HANDLE_VALUE || hHandle == NULL ) { cerr << "错误..." << endl; return -1; } ::SetConsoleTextAttribute( hHandle , FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|BACKGROUND_RED ); cout<<"红色背景+白色字符串"<< endl; ::SetConsoleTextAttribute( hHandle , FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_RED ); cout<<"红色背景+黄颜色的字符串"<<endl; system("pause"); return 0; }