Source code -

Find C and C++ source code to help you learn to program. You can submit your own code, or you can simply browse and download the code of others.

Index :: Utilities /
resource information
Category 8
Description shows a way to change the color of the text in a text window.
Contact Michael Marques
Added 06-24-2003 at 07:22 p.m.
Last Updated 06-24-2003 at 08:23 p.m.
Current Rating 4.82608695652174
Rate Resource
Number of Reviews 21
Review this Resource
  • proofreading service <a href="">writing services</a> reliable essay writing service <a href=>essay writing services</a>
    posted at 06:05 p.m. on 01-19-2018
  • loans no credit check <a href="">money loans no credit check</a> loans no credit check <a href=>the lending company</a>
    posted at 09:27 p.m. on 01-16-2018
  • payday installment loan <a href="">installment loans</a> direct lenders online loans <a href=>installment loans</a>
    posted at 08:55 p.m. on 01-13-2018
  • direct payday lenders bad credit <a href="">no credit check emergency loans</a> quick loans <a href=>quick loans 100 approval</a> college paper <a href="">research paper</a> term paper <a href=>college paper</a> best essay writing service <a href=""> homework help</a> paper writing service <a href=>best essay writing service</a>
    posted at 02:09 p.m. on 01-13-2018
  • cash loan <a href="">payday loan</a> loan <a href=>loan</a>
    posted at 04:53 a.m. on 01-13-2018
  • direct loan lenders <a href="">payday loans</a> loan <a href=>payday loan</a>
    posted at 08:34 p.m. on 01-12-2018
  • car insurance <a href="">compare auto insurance rates</a> car insurance <a href=>commercial auto insurance quotes</a>
    posted at 01:08 a.m. on 12-24-2017
  • essay writing service <a href=>essays writing services</a> essay writing service review <a href=>essay writing service</a>
    posted at 02:33 p.m. on 11-01-2017
  • <a href=>azithromycin</a> e98hd9uq3U
    posted at 03:22 p.m. on 09-14-2017
  • <a href=>buy crestor</a> <a href=>zoloft generic brand</a> <a href=>buy levitra from canada</a> <a href=>buy indocin</a>
    posted at 02:10 p.m. on 09-13-2017
  • <a href=>cheap custom essay writing service</a> <a href=>payday loans online</a>
    posted at 08:34 a.m. on 09-10-2017
  • wh0cd839808 <a href=>Metformin ER</a> <a href=>cipralex</a> <a href=>generic nexium</a>
    posted at 12:45 a.m. on 08-25-2017
  • wh0cd332599 <a href=>cheap cialis pills online</a> <a href=>amitriptyline without prescription</a>
    posted at 10:28 p.m. on 06-13-2017
  • PglqsM <a href="">oplqxxsdcyqb</a>, [url=]iiftzlgbegfp[/url], [link=]ultxzmxwvgba[/link],
    posted at 03:53 a.m. on 12-20-2016
  • OHQt12 <a href="">akvebesdbhed</a>, [url=]qlcamppzfhzo[/url], [link=]wfcttnwyzwrb[/link],
    posted at 10:20 a.m. on 07-14-2016
  • gLLD1Y <a href="">mlbmatustcgl</a>, [url=]rrcyfuawhdwg[/url], [link=]jhnklbsflzzj[/link],
    posted at 11:19 p.m. on 07-02-2016
  • just add the line "system ("PAUSE");" right before the return of main. #include "global.h" //header files, function prototypes, & classes void setcolor(unsigned short color) { //begining of set color funtion HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); //gets std handle SetConsoleTextAttribute(hCon,color); //Sets Console Text Attribute HCon color. } //end of set color funtion int main() { //begining of main funtion printf("What color do you want the text to be?(1 = blue, 2 = green, 4 = red, 14 = yellow)"); //displays text scanf("%d", &C.I); //scans number setcolor(C.I); //sets color cout << " _____ ____ ____ _____\n"; //displays text cout << "|_ _|| __ || ___||_ _|\n"; //displays text cout << " | | | __||__ | |\n"; //displays text cout << " | | | |__ __| | | |\n"; //displays text cout << " |_| |____||____| |_|\n"; //displays text system ("PAUSE"); return 0; //returns 0 } //end of main function
    posted at 09:11 p.m. on 12-20-2004
  • lol people. Here's the thing, when programs are done running their tasks, they terminate, everything goes so fast you don't see anything, you just have to give it an infinate loop at the end before return. for(;;), while(1);, while(true); Either of those
    posted at 07:53 p.m. on 08-26-2004
  • I had to work a little to get the source to compile with Dev-C++, but finally got it to work with warnings...i added the line "#include <iostream>" for cout, then before the functions "using namespace std;" for cout, and also to fix the problem of the program ending early, add the line "getchar();" TWO times before the return statement. sloppy code...
    posted at 08:13 p.m. on 04-05-2004
  • yeah... I dont understand it,,, "choose color 1=blue" you press 1, and the progg ends...wierd..
    posted at 11:13 a.m. on 03-13-2004
  • seems tow ork fine. when you run the .exe it ends before you have a real chance of seeing the colour but it is there.....
    posted at 07:42 p.m. on 11-30-2003