loop-- not sure whats wrong

This is a discussion on loop-- not sure whats wrong within the C++ Programming forums, part of the General Programming Boards category; Im making a loop from the tutorials and I enter it into my compiler,and no matter what I do it ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    106

    Unhappy loop-- not sure whats wrong

    Im making a loop from the tutorials and I enter it into my compiler,and no matter what I do it doesn't seem to work..

    Code:
     #include <iostream>
    using namespace std;
    int main()
    {
        for ( int x = 0; x < 10; x++ ) {
            cout<< x <<end1;
        }
        cin.get();
    }
    thanks,

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,397
    How does it not work?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    106
    Quote Originally Posted by laserlight View Post
    How does it not work?
    its givng me two error messages which I have learned can throw you completely off when using Dev C++

    It says one in the "int main()" function
    and then it says that end1 is undeclared first use this function

    and to me when I removed all the comments from the other program they look exactly the same... and the other one compiles fine... I'm used to python so preprocessors and everyhting is new to me....

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,397
    Quote Originally Posted by jamort
    It says one in the "int main()" function
    and then it says that end1 is undeclared first use this function
    You might want to post the actual text of the error messages. That said, from what you have described, I believe that you mistakenly wrote end1 (as in "end" "one") rather than endl (as in "end" "lowercase L", which can read as "end line").
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    106
    Quote Originally Posted by laserlight View Post
    You might want to post the actual text of the error messages. That said, from what you have described, I believe that you mistakenly wrote end1 (as in "end" "one") rather than endl (as in "end" "lowercase L", which can read as "end line").
    thanks, my mistake that was the problem they appear exactly the same

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. loop the loop - feeling foolish
    By estos in forum C Programming
    Replies: 2
    Last Post: 04-07-2007, 02:45 AM
  2. Replies: 1
    Last Post: 10-27-2006, 01:21 PM
  3. I need help as soon as possible.
    By hyrule in forum C++ Programming
    Replies: 7
    Last Post: 11-09-2005, 04:49 PM
  4. What is wrong with my while loop?
    By aspand in forum C Programming
    Replies: 3
    Last Post: 06-19-2002, 12:07 PM
  5. Whats wrong w/ my loop?? Please help?
    By aspand in forum C Programming
    Replies: 6
    Last Post: 05-30-2002, 03:42 AM

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