Below is a simple function i created for my program but i am running into a problem. When I build the program and this function gets called, it totally skips the first initial input (last name) but it does print out the cout. I also tried using cin>> to get the input, but there are some inputs that i need to include white spaces which is the reason why im using getline. but if i use cin>> for one input and getline for another, when a space is entered, it stores that information into the next variable instead of storing it all into one variable. Any ways to fix this? I read that there are problems when you mix up >> operator with getline. Please help
Indeed, its >>'s fault. The thing is that cin>> reads one word and stops immediately, thus leaving the '\n' from pressing Enter in the stream. This '\n' is then found by getline. It would be good to have a cin.ignore() after every cin>> so that there is never any rubbish in the stream. Only adding cin.ignore() on line 13 (that is, before line 15) should work fine too.