I guess somewhere you're using stream extraction cin >> to obtain input from the keyboard? This does not play nice with getline().
>> ignores any leading white-space chars (space, tab, \n) and then extracts from the stream up-to a white space but leaves the white space char in the buffer.
getline() extracts from the buffer all chars up-to and including the terminating char (\n by default if not specified) and does not ignore leading white-space.
When getline() is used after >>, the terminating white-space char is still in the buffer (often \n) which is then obtained by getline() and if it is \n will terminate it.
ignore() will ignore up-to a specified number of chars until the specified delimiter. However, if there are no chars available - or no specified delimiter, this will 'hang' until the specified delimiter has been entered.
If you mix >> with getline(), one way to fix this is to use:
after each cin >> which will ignore the \n (usually) char terminating the input.
Also to just test the first char, strcmp isn't what is used. Just test the first char direct. eg something like:
|
option = toupper(userChoice[0]);
|