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++.

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! ";
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.