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;
reads an int but leaves a newline behind.
int
cin.get();
reads that newline, and the program ends.