QUESTION IMAGE
Question
- assume a string object has been defined as follows: string description; a) write a cin statement that reads in a one - word string. b) write a statement that reads in a string that can contain multiple words separated by blanks.
Step1: Read one - word string
In C++, to read a one - word string using cin, we can directly use cin with the variable name.cin >> description;
Step2: Read multi - word string
To read a string that can contain multiple words separated by blanks, we use getline(cin, description);
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
A. cin >> description;
B. getline(cin, description);