Terminal closes before finishing process

#1

I was trying a little code from another video. It ask for a number between 1 and 100, when i put a number in it does not display the output. It instead just closes the cmd screen. I even tried to build it and run the .exe file and it does the same thing.

#include <iostream>

//closes after entering a number

int main()
{
	int FavoriteNumber;

	std::cout << "Enter your favorite number between 1 and 100: ";

	std::cin >> FavoriteNumber;

	std::cout << "Cool Number!" << std::endl;

	return 0;
}

maybe its a setting that im not aware of? I am using Visual Studio 2017 the video was using CodeLite, not sure if that matters. I am new and still trying to learn c++.