Making my program colorful, literally.

closed account (z0XLy60M)
Okay , so I got a school project due.

It's about supermarket billing, (You can enter products (as admin) , choose from a list to buy em see what the cost is going to be and other BS like this)


What I want to do is , in every different menu I want a different color.

I need a simple (library) function..that I can simply put in the first line of my different menu functions ,and for that particular screen the color will be something other than the main menu...

Any ideas ?
If you want to output to the console window, then you need additional libraries. There is no standart library, which can change locor of the text.
closed account (DETpfSEw)
Hello Thunderman: what you have to do is that just write following function code in your main program and call it with passing different numbers. it will produce different colours for text on your consloe:

1
2
3
4
5
void setcolor(unsigned short color)//color setting
             {
             HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
             SetConsoleTextAttribute(hcon,color);
             }


you have to call this function like this:
setcolor(13);
for different colors use different nubers instead of 13.


if you want to use a simple technique then try:
system("color 0c");
here you also can change "0" and "c" with any number 0-9 or alphabit a-f.
InshahAllah it will help you.
Enjoy...
closed account (z0XLy60M)
Hey, for that setcolor thing, do I need to include any files or sumthim...?
closed account (DETpfSEw)
Thunderman! you don't need to include any file.
closed account (z0XLy60M)
It's
"thunde-"

no 'r'...

;p


n thnx :)
Topic archived. No new replies allowed.