Change text color using visual c++

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2009
Posts: 1
Reputation: phr34k1sh is an unknown quantity at this point 
Solved Threads: 0
phr34k1sh phr34k1sh is offline Offline
Newbie Poster

Simple way...

 
0
  #11
Mar 14th, 2009
Alright... this is all i do... inside of main... right before i access cout... i simply just put on a line before this...

system("color 0a");

This is processing a batch command... and batch is quite simple... if you would like a definition of how this works, simply go to "cmd.exe" and type "help color" this will explain how to use this... you can change the background color of the console with this method... here is an example...

  1. #include "header.h"
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7. system("title Hello World.");
  8. system("color 0a");
  9. cout<<"Hello world.";
  10. system("pause >nul");
  11. return 0;
  12. }

header.h contains
#include <iostream>

so if you're using an older c++ compiler... replace
#include "header.h"
with
#include <iostream>

otherwise you know what to do... peace... hope i could help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC