CONSOLE COLOUR CHANGING IN C++

Structure of the Problem Requirements 

In this problem we will learn about the color changing in Console in C++ Program. For changing colour of text or background we include the windows.h class in C++ program. Windows library deal with such a events. In our program we make an instance of handle class and then use it to change the colour of the required lines. Here is the source code of this problem which help you in better understanding.


SOURCE CODE


#include<iostream>
#include<windows.h>
using namespace std;
int main ()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
SetConsoleTextAttribute(h,FOREGROUND_RED | FOREGROUND_INTENSITY);
cout<<"\t \t \t \t LEP \n \n \n ";
SetConsoleTextAttribute(h,FOREGROUND_GREEN | FOREGROUND_INTENSITY);
cout<<" CEO & Founders  :" <<" Usman Siddique \n " <<endl;
SetConsoleTextAttribute(h,FOREGROUND_BLUE | FOREGROUND_INTENSITY);
cout<<"  Developers      :" <<" Hafiz muhammad usman siddique \n " <<endl;
SetConsoleTextAttribute(h,FOREGROUND_RED | FOREGROUND_INTENSITY);
cout<<"  Website         :" <<" pcphunt.blogspot.com \n " <<endl;
SetConsoleTextAttribute(h,FOREGROUND_GREEN | FOREGROUND_INTENSITY);
cout<<"  Facebook Address:" <<" https://www.facebook.com/usman.siddique.7771 \n " <<endl;
SetConsoleTextAttribute(h,FOREGROUND_BLUE | FOREGROUND_INTENSITY);
cout<<"   Address :" <<"Comsats  \n " <<endl;
}

No comments

Powered by Blogger.