I was about to ask why the following code was skipping question three but I changed the getline statement to a cin and everything is fine now. I was hoping someone could explain why getline doesn't work on single answer responses so I understand the underlying principles though.
Code:int age, pushups; string name, military; char gender; cout << "What is your full name? "; getline (cin, name); cout << "How old are you? "; cin >> age; cout << "Were you ever in the military (yes/no)? "; getline (cin, military); cout << "How many pushups can you do in a row? "; cin >> pushups; cout << "Are you (m)ale or (f)emale? "; cin >> gender;



LinkBack URL
About LinkBacks


