Thread: simple problem (please help)

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    2

    simple problem (please help)

    im working on this project for class and i can't figure out why im getting these errors. I'm only getting 3.. they are:

    `cout' undeclared (first use this function)
    `endl' undeclared (first use this function)
    `cin' undeclared (first use this function)

    if anyone could help me out as soon as possible, i've been through the code lots of times and i know that im using cout, endl, and cin correctly, I just can't figure out why I'm getting those errors or how to fix them

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    1. Make sure you include the library:
    #include <iostream>

    2. Add the namespace
    using namespace std;

    If you don't want to include the namespace, then instead you need:
    std::cout
    std::endl
    std::cin

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    2
    thanks a lot, that helped. now it compiles, and i just need to find out where i made some errors.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A simple file I/O problem
    By eecoder in forum C Programming
    Replies: 10
    Last Post: 10-16-2010, 11:00 PM
  2. Problem in simple code.
    By richdb in forum C Programming
    Replies: 6
    Last Post: 03-20-2006, 02:45 AM
  3. Problem in very simple code
    By richdb in forum C Programming
    Replies: 22
    Last Post: 01-14-2006, 09:10 PM
  4. Simple Initialization Problem
    By PsyK in forum C++ Programming
    Replies: 7
    Last Post: 04-30-2004, 07:37 PM
  5. Simple OO Problem
    By bstempi in forum C++ Programming
    Replies: 1
    Last Post: 04-30-2004, 05:33 PM