Cin and hold the screen

K

Kay

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
 
K

Kai-Uwe Bux

Kay said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top