Some questions

This is a discussion on Some questions within the C++ Programming forums, part of the General Programming Boards category; What does while(cin) mean? What about while(cin.good())? Is there a difference between c=cin.get() and cin.get(c)?...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    65

    Some questions

    What does while(cin) mean? What about while(cin.good())?

    Is there a difference between c=cin.get() and cin.get(c)?

  2. #2
    coder
    Join Date
    Feb 2008
    Posts
    127
    I've personally never used something like while (cin)
    I guess it just checks whether the object cin exists.

    about good() :
    http://www.cplusplus.com/reference/i.../ios/good.html

    about get() :
    http://www.cplusplus.com/reference/i...tream/get.html

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,807
    I guess it just checks whether the object cin exists.
    No, it is (roughly) the same as cin.good().
    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. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 07:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 08:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM

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