Cin and hold the screen

Discussion in 'C++' started by Kay, Sep 5, 2004.

  1. Kay

    Kay Guest

    I want to input sth and store it by string. However, when I input the
    words that contains space, the variable only store the characters after
    the space
    eg...Good Boy <--only store the Boy in the variable

    string word;
    cin >> word;

    How to solve this problem? Also, I want to hold the screen in sub menu?
    When user click enter, the sub menu go back to main menu
    Kay, Sep 5, 2004
    #1
    1. Advertising

  2. Kay

    Kai-Uwe Bux Guest

    Kay wrote:

    > I want to input sth and store it by string. However, when I input the
    > words that contains space, the variable only store the characters after
    > the space
    > eg...Good Boy <--only store the Boy in the variable
    >
    > string word;
    > cin >> word;
    >


    You might want to have a look at what your favorite C++ manual has to say
    about "getline".

    > How to solve this problem? Also, I want to hold the screen in sub menu?
    > When user click enter, the sub menu go back to main menu


    Hm, this question is a little vague. In general, I would have a library of
    my choice handle screen/keyboard io. You might try ncurses and its C++
    wrapper. However, questions about non-standard libraries are generally
    regarded off-topic in this group.


    Best

    Kai-Uwe Bux
    Kai-Uwe Bux, Sep 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Matthews
    Replies:
    0
    Views:
    356
    Thomas Matthews
    Jul 18, 2003
  2. TaiwanNoWhere

    cin and cin.clear() problem

    TaiwanNoWhere, Oct 13, 2003, in forum: C++
    Replies:
    8
    Views:
    4,100
    P.J. Plauger
    Oct 17, 2003
  3. Chris Mantoulidis

    std::cin.ignore() and std::cin.clear()

    Chris Mantoulidis, Jan 6, 2004, in forum: C++
    Replies:
    5
    Views:
    17,156
    Kevin Saff
    Jan 6, 2004
  4. Aleander

    cin and cin.getline()

    Aleander, Mar 6, 2005, in forum: C++
    Replies:
    5
    Views:
    8,682
    Alex Vinokur
    Mar 6, 2005
  5. Fernando
    Replies:
    4
    Views:
    1,667
    Fernando
    Nov 16, 2011
Loading...

Share This Page