Why is the Console Closing after I’ve included cin.get()?

cin >> carrots;

This line leaves a trailing newline token in the input stream, which then gets consumed by the next cin.get(). Just do a simple cin.ignore() directly before that:

cin.ignore();
cin.get();

Leave a Comment