c++ - Proper use of the cin object? -


i using microsoft visual studio build simple windows console application exhibits simple i/o. when input more 1 word assigned string variable using cin object, program automatically displays of following questions immediately. can allow multiple word inputs?

for situations when need string allows spaces, use std::getline in place of >> operator:

std::string withspaces; getline(cin, withspaces); 

Comments

Popular posts from this blog

What can cause "Required Package 'IndyCore' not found" when compiling a Delphi 2010 project? -

Change the color of an oval at click in Java AWT -