In a swicth there are a case:
case 3:
cout << "Digite la palabra que desea añadir: ";
cin >> word;
cout << "Digite el significado de la palabra: ";
getline(cin,auxstr);
result = addWord(word,auxstr);
but when I compile & run the program it’s as if I pressed enter to getline without allow me enter a line:
Digite la opción adecuada: 3
Digite la palabra que desea añadir: a
Digite el significado de la palabra: La palabra a ha sido añadida con éxito en el diccionario
“La palabra a ha sido añadida con éxito en el diccionario” is the output of addWord function.
You still have the
'\n'from the previous line in the buffer, so whengetlinetries to get the input from the buffer, it only takes the'\n'and assumes the job is done, not allowing you to input anything else.Just put
cin.get()beforegetline(cin,auxstr);