Defined user input color

Hello,

I was wondering if it would be possible to create a statement that would allow all user input to be a different color than that of the computers output.

I would like to be able to enter:

1
2
cout << "Hello World" << endl;
cin >> user;

and have whatever you type come out in a different color, however I do not want to have to write:

1
2
SetColor(RED, BLACK);
cin >> user;

every time i want the color to be different.

I know I left out a bunch of code for these, however, would this be possible?
Thank You!
Yes and No. No, because, there is no standard, cross-platfrom method of doing so. However, you CAN utilize the API for your platform to do so, though of course that will be non-compatible with any OS other than yours, and is generally fairly complicated to do correctly.

If you REALLY want to do it, and you run Windows, here is an article with some example code of how to do it:
http://www.cplusplus.com/articles/Eyhv0pDG/
Thank you, this helped and it works now ! :)
Topic archived. No new replies allowed.