I'm trying to work on a question in c++ primer.
Unfortunately, the program doesn't work correctly when i use cin.getline(individual[i].name, SIZE) instead of cin >> individual[i].name which seems to work perfectly. I want to read a line for a name, any assistance is very much appreciated!
If you mix integer input and string input, make you sure you clean up stdin after each integer input.
while(cin.get() != '\n');
this is, because cin >> integer leaves a '\n' in stdin. So if you try to read a name, the program think, you typed a empty line and then proceed to amount input and so on.
Be careful with mixing cin >>, getline and get. get does not clear the delimiter character (a newline) out of the input buffer after you press enter (it doesn't, right?), so getline will take that newline as input and skip over the user's entry.