Link to home
Start Free TrialLog in
Avatar of regent
regent

asked on

Change background color and text color

I am trying to create a simple splash screen program.  Our instructor showed that we'd use the "textbackground" and
"textcolor" functions.  I am using Borland C++ 4.52.

Supposedly all I have to put in my program is:

textbackground(BLUE);
textcolor(YELLOW);

but I come up with errors - "undefined function".

Anybody have any thoughts on how to fix this?

Thanks.
Avatar of chensu
chensu
Flag of Canada image

#include <conio.h>
or
#include <dos.h>
Avatar of regent
regent

ASKER

I did.  Here's my code:


#include <iostream.h>
#include <conio.h>

void main()
{
      textbackground(BLUE);
              textcolor(YELLOW);
      clrscr();
      cout << endl << endl << endl << endl;
      cout << "         ************************************************************";
      cout << endl << endl << endl;
      cout << "                                 THOMAS REGEN" << endl;
      cout << "                                   CPT  123";
      cout << endl << endl;
      cout << "                        PROGRAM NAME:    SPLASH SCREEN";
      cout << endl << endl << endl;
      cout << "         ************************************************************";
      cout << endl << endl << endl;
      cout << "         PRESS ANY KEY TO CONTINUE...";
      getch();
}
Be sure to include <conio.h>
It is the header file that contains the prototype for the background and foreground text colors
Avatar of regent

ASKER

I did include <conio.h>.  See code above.
Try

#include <conio.h>
#include <iostream.h>
Avatar of regent

ASKER

I didn't see a new comment.  

<conio.h> was included.  See code above.
Avatar of regent

ASKER

Nope, that didn't work either.
Avatar of regent

ASKER

Can anyone compile and run my code to see if you can get it to work?
What about #include <dos.h>?
Avatar of regent

ASKER

No, that didn't work either.  This is really frustrating because you know it's gotta be something simple.
Open conio.h and search for textbackground. Is there any #if before it?
Avatar of regent

ASKER

Not that I can tell.
It is DOS ?
Avatar of regent

ASKER

Not that I can tell.
Avatar of regent

ASKER

<dos.h> didn't work either.  Has anyone been able to compile and run my code?  I'm about to give up.
ASKER CERTIFIED SOLUTION
Avatar of AlexVirochovsky
AlexVirochovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of regent

ASKER

Thanks Alex!  You were right, 4.52 (for some reason), doesn't recognize those funictions (even though the Help discusses them).  Once I got to school and compiled it on 5.02, it worked like a champ.  Thanks again.  Thomas