simple problem (please help)

This is a discussion on simple problem (please help) within the C++ Programming forums, part of the General Programming Boards category; im working on this project for class and i can't figure out why im getting these errors. I'm only getting ...

  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-17-2010, 12:00 AM
  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, 08:37 PM
  5. Simple OO Problem
    By bstempi in forum C++ Programming
    Replies: 1
    Last Post: 04-30-2004, 06:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21