This is the basic and simple code of C++ program to change the text color. With different color beginners can make their out of C++ program attractive and stylish.
Source Code
#include "stdafx.h"
#include <iostream>
#include <windows.h> // WinApi header
using namespace std;
int main()
{
cout<<"\a\n\n\n"
<<"\t******************************************************"<<endl
<<"\t** **"<<endl
<<"\t** Welcome To **"<<endl
<<"\t** Console Text Color **"<<endl
<<"\t** Demo **"<<endl
<<"\t** **"<<endl
<<"\t******************************************************"<<endl<<endl<<endl;cout<<"";
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
for(int k = 1; k < 255; k++)
{
SetConsoleTextAttribute(hConsole, k);
cout << k << " Pro Programmer!" << endl;
}
system("pause");
return 0;
}
0 comments:
Post a Comment