I am trying to input n
integers into the vector.
Following is the code I have used to do so. First, I ask for the value n, then input all those n
integers.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> input(n);
for (int i = 0; i < n; i++)
{
cin >> input[i];
}
return 0;
}
I don't know why the program is terminating without taking any input, I can't see any flaws with this code, and it seems to work fine for others but not for me.
This is what the terminal looks like after executing this program.
Input Example:
5
5 3 1 5 2
When I try to compile the program in the windows terminal, I get this error