I'm fairly new to c++ and I was wondering why my cin.get() isn't stopping the program in cmd from instantly closing when it's done? I tried the cin.get() on my previous code and it worked, but for some reason it doesn't work on this code.
#include <iostream>
int main()
{
using namespace std;
int carrots;
cout << "How many carrots do you have?" << endl;
cin >> carrots;
cout << "You have " << carrots << endl;
cin.get();
return 0;
}