Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: hello world colors C++  (Read 5175 times)

0 Members and 1 Guest are viewing this topic.

UNLISTED

  • Guest
hello world colors C++
« 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.

viking



    Adviser
  • miaow-miaow 2.0 for networks
  • Thanked: 1
    Re: hello world colors C++
    « Reply #1 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?

    UNLISTED

    • Guest
    Re: hello world colors C++
    « Reply #2 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?