Loop question

This is a discussion on Loop question within the C++ Programming forums, part of the General Programming Boards category; I don't know if you don't understand or if you disagree... Yes, I understand what an endline does at the ...

  1. #31
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    I don't know if you don't understand or if you disagree...
    Yes, I understand what an endline does at the end of the file, and I also understand how the >>operator and getline() treat endlines differently. However, if there were an endline at the end of the input file, the original code could be modified using the technique where you put an extra read before the loop, and it would not cause an erroneous extra line of input to be read and displayed. Nevertheless, the loop would still be flawed, and once again it does not have anything to do with an endline at the end of the file or the timing of when the eofbit error flag is set.

  2. #32
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. For loop question
    By JuzMe in forum C++ Programming
    Replies: 11
    Last Post: 04-20-2009, 08:39 AM
  2. Loop question
    By kwood965 in forum C Programming
    Replies: 6
    Last Post: 10-29-2008, 11:12 PM
  3. simple for loop function question
    By felicityxiv in forum C Programming
    Replies: 7
    Last Post: 05-06-2006, 11:43 PM
  4. Please don't laugh...SIMPLE loop question!
    By the_lumin8or in forum C++ Programming
    Replies: 5
    Last Post: 03-31-2006, 12:08 PM
  5. while loop question
    By rayrayj52 in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2004, 05:13 PM

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