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
Post a Comment