int main()
{
bool terminate = true;
char option;
string title_final;
while(terminate == true)
{
cout << "A. Add new DVD to collection." << endl;
cout << "H. Nothing." << endl;
cout << "What would you like to do? (Please use only caps - A, B, C, D, E, F, G, or H) : " << endl;
I don't know why getline(cin, title_final); isn't working. According to most sites it should... I'm a student so there must be something I'm just unable to catch. Does anyone see it?
I've done some testing and getline(cin, title_final); only doesn't work when its in that loop that I have "while(terminate == true)". I have no clue why at the moment.
The problem is that cin >> temp; reads the next word and leaves everything after the word still inside the stream. If you pressed enter after writing the word there will be a new line character after the word so when you call getline it will find a new line character and return right away, giving you an empty string.
You need to get rid of the new line character before calling getline. You can use cin.ignore(); to remove one character. If there can be more characters before the new line character you can use cin.ignore(numeric_limits<streamsize>::max(), '\n'); to ignore the rest of the line.
I'm basically getting the first word from cin>> and then the rest gets stored from the getline function into temp2. And then I add the two into temp3 completing the whole string from 1 user input.
I tried peters way, thank you for you help, but it was causing me to have to input the string twice in order to store it into temp for some reason.
Anyway, I thought I would share even if it may be terrible coding, maybe someone more experienced can confirm that, and if not everyone's welcome to use it.