Thread: stuck on loops

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    142

    stuck on loops

    hello, i'm trying to work through lesson 3 ( loops ). for some reason when i type the text from the tutorials into the compiler my self it doesn't work, but when i cut and past it does. i don't know what the hell is going on, if someone has an answer please let me know

    Code:
    #include <iostream>
    
    using namespace std; 
    
    int main()
    {
        for ( int x = 0; x < 10; x++ ) {
             cout<< x <<end1;//this is the line i'm having trouble with
                                          // if i duplicate it by typing it,
                                         // it doesn't work
        
            }
            cin.get();
            }

  2. #2
    Registered User
    Join Date
    Sep 2005
    Posts
    142

    what the hell is it

    cout<< x <<end1;

    is there anything wrong with that, iv'e typed the two together side by side , cut one ran the other, then deleted that one, then paste the other back on, and only one works?????????????????????????????????????????????

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    "end1" should be "endl"
    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

  4. #4
    Registered User
    Join Date
    Sep 2005
    Posts
    142

    i'm wikd

    seriously i knew that

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    lowercase "L"
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Too many loops D:
    By F5 Tornado in forum C++ Programming
    Replies: 6
    Last Post: 12-03-2007, 01:18 AM
  2. Replies: 6
    Last Post: 10-23-2006, 07:22 PM
  3. help with arrays and loops
    By jdiazj1 in forum C Programming
    Replies: 4
    Last Post: 11-24-2001, 04:28 PM
  4. exiting loops with ease?
    By KingRuss in forum Game Programming
    Replies: 3
    Last Post: 09-24-2001, 08:46 PM