Thread: std::getline and cin

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2008
    Location
    IR, Iran
    Posts
    103

    std::getline and cin

    hi,
    I have this code:
    PHP Code:
    ...

    string BookNameAuthor;

    cout << "> Enter book title: ";
    getline(cinBookName);                        // this does not work

    cout << "> Enter author of book: ";
    getline(cinAuthor);                            // but this work!?

    ... 
    the output is:
    > Enter book title: > Enter author of book:
    and then waiting for something to write!

    I don't know what's wrong?
    Last edited by behzad_shabani; 06-08-2009 at 05:14 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Evil
    By Elysia in forum C++ Programming
    Replies: 26
    Last Post: 06-26-2008, 06:20 AM
  2. Treating Types Of Data (Static Cast?)
    By shoover in forum C++ Programming
    Replies: 10
    Last Post: 06-11-2008, 01:29 PM