I found this website today when I was looking for some beginner exercises and it looks like a great community. I decided to try the cola machine exercise and had fun building it, but came across an error.
Can someone tell me why the code outputs incorrectly when someone types in "5." for Tequila instead of "5". Everything else seems to work fine. Thanks in advance!
Interesting... for me when I type in "5." for Tequila, the output is my first "else if" and the last "else" statement all at once. It doesnt prompt the user like it should if you just type "5"
When you enter "5.", the period is still in the input stream after reading the number and so cin >> lime; reads it. You can use ignore() to discard it, e.g. cin.ignore(1,'\n');
See http://www.cplusplus.com/reference/iostream/istream/ignore/