Thread: undeclared?

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    47

    undeclared?

    why dose it tell me 'cout' is undeclared

    Code:
        cout<< "How many buggs will we have today? \n";
        cin>> y;
        cout<<"We will have" << y <<"buggs today get ready";
        while ( x = y )

  2. #2
    Learn from the llama Marlon's Avatar
    Join Date
    Jun 2005
    Location
    South africa
    Posts
    25
    Did you include iostream.h?

    #include <iostream.h>
    `Who are YOU?' said the Caterpillar.
    This was not an encouraging opening for a conversation. Alice replied, rather shyly, `I--I hardly know, sir, just at present-- at least I know who I WAS when I got up this morning, but I think I must have been changed several times since then.' - Lewis Caroll's Alice in Wonderland.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    47
    thanx i forgot that.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    47

    ok

    i guss that wasnt it this is the whole code...Its kind of a joke...

    Code:
    #include <isostream.h>
    
    int main()
    {
        int y;
        int x = 0;
        int z = 0;
        int justin = 0;
        cout<< "How many buggs will we have today? \n";
        cin>> y;
        cout<<"We will have" << y <<"buggs today get ready";
        while ( x = y )
        {
              cout<<"Error can't find disk /n";
              cin.get();
              cout<<"Ram undefined \n";
              cin.get();
              cout<<"harddrive has mailfunction shuting down \n";
              while ( z = 10 )
              {
                    cout<<" \n";
                    z ++;
              };
              cout<<"Rebooting... \n";
              cout<<".... /n ... /n .... \n ..... \n ... \n";
              cout<<"rebooted \n" <<"virus detected \n" <<"accesing \n" <<"opening \n" <<"starting \n";
              while ( justin = 15 )
              {
                    cout<<"... \n" <<".... \n" <<"..... \n" <<"... \n";
                    justin ++;
              };
              x ++;
        };
    }

  5. #5
    C/C++Newbie Antigloss's Avatar
    Join Date
    May 2005
    Posts
    216
    iostream.h is old and out of date

    try this
    Code:
    #include <iostream>
    
    using namespace std;

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    47
    i used the changes and still

    11 C:\Documents and Settings\Owner\My Documents\super fun game.cpp `cout' undeclared (first use this function)

    (Each undeclared identifier is reported only once for each function it appears in.)

    that is the exact error message..

  7. #7
    C/C++Newbie Antigloss's Avatar
    Join Date
    May 2005
    Posts
    216
    Well, look at your code. Note what I have changed for you.
    Quote Originally Posted by firefly
    Code:
    /*
     *#include <isostream.h>//it should be iostream
    */
    #include <iostream>
    
    using namespace std;
    
    
    int main()
    {
        int y;
        int x = 0;
        int z = 0;
        int justin = 0;
        cout<< "How many buggs will we have today? \n";
        cin>> y;
        cout<<"We will have" << y <<"buggs today get ready";
        while ( x = y )//should this be != or ==
        {
              cout<<"Error can't find disk /n";
              cin.get();
              cout<<"Ram undefined \n";
              cin.get();
              cout<<"harddrive has mailfunction shuting down \n";
              while ( z = 10 )//should this be != or ==
              {
                    cout<<" \n";
                    z ++;
              }/*; this `;' is uneccesary*/
              cout<<"Rebooting... \n";
              cout<<".... /n ... /n .... \n ..... \n ... \n";
              cout<<"rebooted \n" <<"virus detected \n" <<"accesing \n" <<"opening \n" <<"starting \n";
              while ( justin = 15 )//should this be != or ==
              {
                    cout<<"... \n" <<".... \n" <<"..... \n" <<"... \n";
                    justin ++;
              }/*; this `;' is uneccesary*/
              x ++;
        }/*; this `;' is uneccesary*/
    
        return 0;// put return 0 here
    }
    Last edited by Antigloss; 06-20-2005 at 08:20 AM.

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    47
    thanx for the help

  9. #9
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    While we're at it, you might want to check your slashes again.
    Code:
    cout<<".... /n ... /n  .... \n ..... \n ... \n";
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  10. #10
    Registered User
    Join Date
    Jun 2005
    Posts
    47
    i noteced that on my own but thanx for the input..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM