Recently started learning c++ and wanted to try to use inputs. Just made a very basic program that tells you the number of weeks in a given number of days with remaining days included. Whenever I run this program in Visual Studio Code it runs the code but it waits for a input with not way to input. Tried to build this program with g++ but the ending .exe closes out when pressing enter. Nothing is wrong with the code itself since I tried it in a online compiler and it worked perfectly. Also ran it through navigating to it through command prompt with cd and that also worked. Is there anyway visual studio code can accept inputs? and is there anyway to fix command prompt closing when pressing enter when opening built .exes from the desktop?
#include <iostream>
using namespace std;
int main () {
int days;
int weeks;
cin >> days;
weeks = days / 7;
cout << "There are/is " << weeks << " weeks for every " << days << " days " << endl;
cout << "There is " << days % 7 << " remaining days" << endl;
}