endl gone whacky

This is a discussion on endl gone whacky within the C++ Programming forums, part of the General Programming Boards category; wtf is wrong with this code? visual c keeps puking on the endl;, says its an undeclared identifier...even went to ...

  1. #1
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001

    endl gone whacky

    wtf is wrong with this code? visual c keeps puking on the endl;,
    says its an undeclared identifier...even went to the extreme of wiping the project and copying the original code into a new one....
    Code:
    #include <iostream>
    #include <fstream>
    #include <time.h>
    #include <string>
    
    
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////GLOBALS
    double version=0.1;
    int length;
    string input; //use for loop to change to a new char array[length] then make char ouput[length]
    
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////MAIN
    int main()
    {
    	std::cout<<"Encryptor v"<<version<<endl;
    	std::cout<<"\n\n\n\n\nCopyright Drew Peterson\n2002\nAll Rights Reserved"<<endl;
    	return 0;
    }
    It's also not liking the string type, even though i included <string>
    wtf??
    PHP and XML
    Let's talk about SAX

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    One point -


    using namespace std;

  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    right, you knew to use the std:: for the cout but not the endl

    it would be written std::endl unless you chose to use the using line as fordy suggested. Then you need to get rid of your std::couts

    Fun huh?
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  4. #4
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    wow
    what a newbie mistake...i forgot to do the using namespace ...
    shoot me
    PHP and XML
    Let's talk about SAX

  5. #5
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378
    what a newbie mistake...i forgot to do the using namespace ...
    I am glad you did that it gave me a chance to learn something new. Hey! everybody makes silly mistakes and i make more than my share.
    Later.
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  6. #6
    Shadow12345
    Guest
    shoot me
    *bang*
    darn, another miss, shoot me!

    don't sweat mistakes, best way to learn dude!

    I make like 100 every day, often the same ones over and over and over and over.

    I think you can also use flush. It clears the buffer, but it doesn't go to the next line.

    cout << "cheese" << flush;

    i dunno endl is better
    Last edited by Shadow12345; 11-11-2002 at 02:36 PM.

  7. #7
    ...
    ... is offline
    Registered User
    Join Date
    Feb 2002
    Posts
    465
    this has always bothered me, but ive been afraid to ask (figuring its a dumb question):

    i never use endl, only "\n". what is the difference, and what advantage would i have using one over the other?
    I came up with a cool phrase to put down here, but i forgot it...

  8. #8
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by ...
    this has always bothered me, but ive been afraid to ask (figuring its a dumb question):

    i never use endl, only "\n". what is the difference, and what advantage would i have using one over the other?
    http://www.cprogramming.com/cboard/s...threadid=28102

  9. #9
    ...
    ... is offline
    Registered User
    Join Date
    Feb 2002
    Posts
    465
    ah... hmm...
    I came up with a cool phrase to put down here, but i forgot it...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. endl or \n ?
    By plain in forum C++ Programming
    Replies: 5
    Last Post: 09-01-2006, 02:50 PM
  2. endl - \n
    By Hugo716 in forum C++ Programming
    Replies: 8
    Last Post: 05-25-2006, 03:33 PM
  3. Endl - Undeclared identifier.
    By MipZhaP in forum C++ Programming
    Replies: 9
    Last Post: 03-03-2005, 11:01 AM
  4. endl vs \n
    By Chewbacca in forum C++ Programming
    Replies: 5
    Last Post: 09-08-2002, 01:42 PM
  5. "\n" or endl
    By itld in forum C++ Programming
    Replies: 2
    Last Post: 11-02-2001, 01:05 AM

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