Thread: Whats the difference between cout and std::cout?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User mdshort's Avatar
    Join Date
    Dec 2003
    Posts
    6

    Post Whats the difference between cout and std::cout?

    Hey, I'm making a program, and I want it to be as neat as possible. And I was wondering if there really was a difference between using std:cout<<""; rather than just using cout<<"";. I'm making an RPG, which I'm making for learning purposes.

    Also, I'm new to this, and I've read the tutorials, and I've come to find the explanations of pointers is very confusing. And its used in ways later on in the cprogramming.com tutorials in ways that it had'nt explained before. I'm aiming for a book soon, but for now im going to use this. Please explain pointers.

    And to make life easier for me and possibly for others, i was wondering how I could make a function to make colors easier to call.

    This is what I have so far:

    Code:
    int txtclr(int clr0, int clr1, int clr2, int drk)
    {
        HANDLE hConsoleOut;
        hConsoleOut=GetStdHandle(STD_OUTPUT_HANDLE);
        if ()
        {
        }
    }
    Thats only an example of how i'm thinking the program up. This is very mind boggling. How would I design a short function to make such a complex funtion complete? I could make an if statement for EVERY SINGLE variation, but that would be more work than needs to be put into it. I've thought of making it so that if its true, define a variable to be the FOREGROUND_COLOR part of the color definition, but how would I do that? I've tried just putting the variable into the color call:

    Code:
        SetConsoleTextAttribute(hOut,
        clr0[] |
        clr1[] |
        clr2[];
    When I do this I get an error, how would I implement this? I'm going to just use and if statement to see which colors are being used, but that would mean doing EVERY SINGLE variation, so it would be more work than just doing EVERY SINGLE variation of the color call. The program i'm making will use colors often, so I want to make this easier on me. Maybe if someone has a script which does this, or can help me develop this function we can have it as a resource for those who don't want to define the color with all the code it requires.

    If someone has a solution, thanks alot.
    Thanks in Advanced,
    -Mike

    [EDIT]
    Whew that was alot of typing.
    [/EDIT]
    Last edited by mdshort; 12-28-2003 at 11:11 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binding cout?
    By Elysia in forum C++ Programming
    Replies: 14
    Last Post: 10-16-2008, 06:41 AM
  2. cout and std::cout
    By alyeska in forum C++ Programming
    Replies: 15
    Last Post: 09-23-2007, 12:43 AM
  3. New, making a survey program
    By shaffer in forum C++ Programming
    Replies: 18
    Last Post: 12-01-2006, 11:36 AM
  4. Binary I/O with cin and cout
    By The Urchin in forum C++ Programming
    Replies: 4
    Last Post: 10-24-2006, 12:47 PM
  5. cout vs std::cout
    By none in forum C++ Programming
    Replies: 10
    Last Post: 07-26-2004, 11:20 PM