0

I have a problem with c++. I want to change text colour in C++ without using cprintf in <conio.h>. Can you help me to chang txtcolor by using cout or other c++.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Nick Evan
0

If your using windows, you could try this demo:

#include <iostream>
#include <windows.h>
 
int main()
{
    HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
 
    for (unsigned i = FOREGROUND_BLUE; i != COMMON_LVB_LEADING_BYTE; ++i) {
        SetConsoleTextAttribute(console, i);
        std::cout << "Pretty colors! ";
    }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.