cin.ignore(256, '\n');
because you've use cin >> before getline() i'm no expert but base on what i know, when you have use cin to get an integer input a newline character is left in the stream which is use by the getline function as a guide that it is the end of the input.. adding this piece of code before using getline() might solve the problem cin.ignore(256, '\n'); |
getline() command is not working or being ignored for some reason |