user input

I have a problem that states:
age is an int variable and name is a string.
What are the values of age and name after the following input statements execute.

cin << age;
getline(cin, name);

if the input is:
a. 23 Lance Grant

b. 23
Lance Grant

Ok I have been fooling around with this book all day. My instructer wants us to build the program instead of just saying a = 23
Lance Grant
I can not for the life of me figure out how to input B. I mean when I write the program I do not know how to ask for two lines for one input.

please help a noob!
After cin reads 23 for age, it's still on the end of the line with the 23. Then getline reads the rest of the line (nothing) and goes to the next, right before "Lance Grant".
Topic archived. No new replies allowed.