Results 1 to 22 of 22

Thread: != -1 exit while loop?

Threaded View

  1. #1

    Thread Starter
    Frenzied Member aewarnick's Avatar
    Join Date
    Dec 2002
    Posts
    1,037

    != -1 exit while loop?

    while ( (letter= cin.get () ) != -1)

    Would that work correctly? What I mean is the != -1 part used to exit the while loop.

    I am reading this college book on C++ and they used EOF instead of -1. Which one is better? End of File just seemed harder to tell what to press to me.
    Last edited by aewarnick; Dec 31st, 2002 at 03:15 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width