I'm very new to programming still and have an assignment for a distance education class of mine that I'm not grasping very well. I'm supposed to create a class named HealthProfile with member attributes first name, last name, gender, day of birth, month of birth, year of birth, height, weight. I'm supposed to request and return this information. I know I shouldn't be having this much trouble with such a simple task, but I'm stumped! This is what I have so far, and when I run it, it requests and returns the first and last name perfectly. When it asks for gender I enter "M" and press the enter key, the program immediately ends after. What gives?! I realize that I haven't even put anything in int main() yet, so that baffles me even further as to why it is running somewhat okay?
edit: I'm not asking for a complete answer either, just a hint as to what in the world is even happening :(
Looks really good but think of classes as containers for encapsulating data. The getline stuff should be located outside the class for a program that uses it, you should be storing and manipulating data within the class not obtaining directly from an input program, I used to do that a lot. Its better for your class to spit out information and absorb information and to manipulate or use that information ... hey anything is possible.
If your issue with input was located outside the class yo wouldn't be concerned with the innards of the class itself but since you implemented getline within the class function, now you have to reach in and mess around with the class which could then mess other stuff and other stuff and you get the idea.