colored text

This is a discussion on colored text within the C++ Programming forums, part of the General Programming Boards category; how do you mkae colored text i just want to use the simple hello world program but have it in ...

  1. #1
    Registered User
    Join Date
    May 2006
    Location
    uk
    Posts
    14

    colored text

    how do you mkae colored text i just want to use the simple hello world program but have it in colored text how would i go about doing this

    Thank you in advance

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    http://www.adrianxw.dk/SoftwareSite/index.html

    Click on colour

    As long as you use windows and don't need cross platform compatability.

    You didn't state your OS

  3. #3
    Registered User
    Join Date
    May 2006
    Location
    uk
    Posts
    14
    sory my OS is windows xp home edtion

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Well there you go, youcan use my link.

  5. #5
    Registered User
    Join Date
    May 2006
    Location
    uk
    Posts
    14
    Thank you grate help to me

  6. #6
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    I have that effect on cheese

  7. #7
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    Or you could use this function:

    Code:
    void Color  ( int BackgroundColor, int TextColor )
    {
     int SeclectedColor = (16*BackgroundColor) + (TextColor);
    
     HANDLE hConsole;
     hConsole = GetStdHandle ( STD_OUTPUT_HANDLE );
     SetConsoleTextAttribute ( hConsole, SeclectedColor );
    }
    The background and text numbers take numbers from 0 to 15. You can use these #defines:

    Code:
    #define BLACK			 0
    #define BLUE			 1
    #define	GREEN			 2
    #define AQUA			 3
    #define RED			 4
    #define PURPLE			 5
    #define YELLOW			 6
    #define WHITE			 7
    
    #define GREY			 8
    #define LIGHTBLUE		 9
    #define LIGHTGREEN		10
    #define LIGHTAQUA		11
    #define LIGHTRED		12
    #define LIGHTPURPLE		13
    #define LIGHTYELLOW		14
    #define BRIGHTWHITE		15
    example:

    Code:
    cout<< "Hel";
    Color( BLACK, RED );
    cout<< "lo wor";
    Color( BLACK, BLUE );
    cout<< "ld!";

  8. #8
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Isn't that pretty much the same as what I showed him?

  9. #9
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    I know. I just showed it to him, and you showed him a link.

  10. #10
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Right, gotcha. I just knew it was there I haven't looked at it in months.

  11. #11
    Registered User
    Join Date
    May 2006
    Location
    uk
    Posts
    14
    cheers guys for heloping em out im still a newbie at C++

  12. #12
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    As am I. I just knew where to look.

  13. #13
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Funny how just a few months ago I made a thread about this? ( and many before me ) as I came to find out through Searching

  14. #14
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Curses! This "Raigne" fellah hath unearthed the secret to our eternal powah! Minions, casth the fool into Banniation, where he shalt suffah!
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 02:17 PM
  2. Colored Text in C
    By colorC in forum C Programming
    Replies: 4
    Last Post: 02-23-2004, 03:58 AM
  3. how to cout colored text?
    By Guanhui in forum C++ Programming
    Replies: 1
    Last Post: 07-05-2002, 08:14 AM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  5. Colored Text
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 11-28-2001, 08:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21