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

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

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -