I\'ve just started learning C++ using C++ Primer Plus but I\'m having trouble with one of the examples. Like the book instructed I included cin.get() at the end
cin.get()
cin >> carrots;
Gets an integer input and leaves a new line after pressing enter key.
cin.ignore();
Place this after getting inputs to avoid the exit of console.