Thread: O_o cin and cout aren't declared?

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    10

    O_o cin and cout aren't declared?

    Code:
    #include <iostream>
    
    
    int main()
    {
        int aArray[12];
        
        cin >> aArray [4];
        
        cout << aArray [4];
        
        return 0;
    }
    Sorry if this is some really simple mistake, but I am just starting, (suppose it's obvious with the simplicity, but it was just to try it and see if I could get it to work,) but I thought iostream declared cin and cout?

    Any help is really appreciated. Thanks.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    std::cin, std::cout.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    10
    ?

    Never had to use std:: before. They've always worked straight away like that.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Never had to use std:: before. They've always worked straight away like that.
    You're probably used to a pre-standard compiler. The C++ standard introduced namespaces and placed every name in the standard library within the std namespace. Qualification is required on every compiler that claims to be standard.
    My best code is written with the delete key.

  6. #6
    Registered User
    Join Date
    Jul 2006
    Posts
    10
    Guess it makes sense. I hadn't used dev-c++ since I updated it.

  7. #7
    Registered User
    Join Date
    Jul 2006
    Posts
    10
    Thanks again

    (Sorry for the double post)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary I/O with cin and cout
    By The Urchin in forum C++ Programming
    Replies: 4
    Last Post: 10-24-2006, 12:47 PM
  2. Overriding Cin with Cout
    By Tainted in forum C++ Programming
    Replies: 5
    Last Post: 10-06-2005, 02:57 PM
  3. I'm REALLY confused. Why isn't cout or cin working here?
    By niudago in forum C++ Programming
    Replies: 8
    Last Post: 02-15-2003, 05:53 PM
  4. cin and cout
    By quentin in forum C++ Programming
    Replies: 6
    Last Post: 04-27-2002, 02:04 PM
  5. i don't know about cin, cout, flag.
    By comwin in forum C++ Programming
    Replies: 2
    Last Post: 11-08-2001, 04:26 AM