Thread: what does cin.ignore( ) mean?

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    9

    what does cin.ignore( ) mean?

    Alright, I'm using Code::Blocks.

    So, what does cin.ignore() mean? I'm still learning C++ because I'm a beginner.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    in cases like this, google is your friend, but I'll throw you a bone. C++ Reference

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    9
    Quote Originally Posted by Elkvis View Post
    in cases like this, google is your friend, but I'll throw you a bone. C++ Reference
    What do they mean of "Extract and discard characters"? It ignores strings/letter inputs?

  4. #4
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by Conti View Post
    What do they mean of "Extract and discard characters"? It ignores strings/letter inputs?
    Sort of..
    Suppose the user enters a whole sentence ..and you 'get' only the first word.
    Using std::cin.ignore(LengthOfSentence, '\n') will remove the other words from the input buffer, until the newline ..so that the next time you use cin, they can't interfere.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cin.ignore()
    By valthyx in forum C++ Programming
    Replies: 2
    Last Post: 07-22-2008, 04:23 AM
  2. cin.ignore();
    By BlackSlash12 in forum C++ Programming
    Replies: 7
    Last Post: 08-24-2007, 02:20 PM
  3. Console window waiting on cin.ignore() or cin.ignore(2)
    By The SharK in forum C++ Programming
    Replies: 3
    Last Post: 07-19-2006, 04:17 PM
  4. ignore
    By indigo0086 in forum C++ Programming
    Replies: 1
    Last Post: 11-13-2002, 09:56 AM