Computer Hope

Software => Computer programming => Topic started by: UNLISTED on November 06, 2004, 02:06:53 PM

Title: hello world colors C++
Post by: UNLISTED on November 06, 2004, 02:06:53 PM
hi everyone. i just got dev C++. a verry good compiler.
i have created the classic "hello world" prog.
what i want to do is to set the text/bg colors.

i read that the code is:

text(color);
textbackground(color);

or something.
please tell me the correct syntax and exactly what line to put it on in the old hello world:

#include <iostream.h>

main()
{
   for(;;)
   {
       cout << "Hello World! ";
   }}

please help.
Title: Re: hello world colors C++
Post by: viking on November 30, 2004, 10:54:02 AM
I don't have a C compiler right now. You will need to include one more library (another #include name_of_library_needed, where the definitions for the 2 functions, text() and textbackground()) for that settings, I think.

Your program will look like that:

text(color);
textbackground(color);

or something.
please tell me the correct syntax and exactly what line to put it on in the old hello world:

#include <iostream.h>
#include <the_other_libraryes_you_need>
main()
{
   text(choose_colour); // choose_colour: a number or a string indicating your colour
textbackground(choose_another_colour); //same eplanation as above


  cout << "Hello World! ";
}


Why did you put a for() there?
Title: Re: hello world colors C++
Post by: UNLISTED on December 19, 2004, 12:39:32 PM
when i put in that code (say i want it red with green bg)

#include <iostream.h>  
#include <stdlib.h>  
main()  
{  
   text(red);
textbackground(green);
  cout << "Hello World! ";  
}  


it doesnt compile properly :( does anyone have a ny other solutions?? eg: maby its the FFFFFF 000000 colors?