You have to add cin.ignore()
right after options is chosen:
//get the input from the user
cin >> option;
cin.ignore();
And cin.ignore()
is not necessary after your getline
:
getline(cin, task); // THIS IS WHERE THE ISSUE COMES IN
//cin.ignore();
The problem is in options
- if you didn't call cin.ignore()
after it, options will contain end of line and loop will continue...
I hope this helps.