Thread: Getline is driving me crazy

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    25

    Getline is driving me crazy

    In main I have

    string str_choice;

    I am trying to use

    cout << "Please enter date in mm/dd/yyyy format";
    getline(cin,str_choice);
    cout << str_choice;

    for some reason it will do the first cout fine but then it doesn't allow me to enter a date in it just skips the getline(cin, str_choice) line of code. I am sure it is something simple, but I can't find it.

    Thanks,
    Chris

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    I juut answered a question like this a few days ago...use cin.ignore()...

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    110
    another solution is to use cin.get();

    Both solve the problem ( to an extent )

    Later,
    WebmasterMattD
    WebmasterMattD.NET

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. This program is driving my crazy!
    By zyphirr in forum C Programming
    Replies: 8
    Last Post: 12-05-2008, 05:36 PM
  2. This is driving me crazy! 256 colors palette
    By manugarciac in forum C++ Programming
    Replies: 0
    Last Post: 04-29-2007, 05:36 PM
  3. Debugging driving me crazy
    By sand_man in forum C Programming
    Replies: 9
    Last Post: 07-07-2005, 04:37 PM
  4. IE 6 and Banner Ads is driving me crazy
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 01-09-2002, 02:18 AM
  5. This pop-up's is driving me crazy.
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 12-22-2001, 09:26 PM