My c++ programs are not working when using vectors. The code of my program is given below, I am able to compile the file but when I try to run it just throws an error.
#include <iostream>
#include <vector>
int main(){
std::vector<int> a;
a[0]= 10;
std::cout << a[0] << std::endl;
a[0]= a[0]*10+5;
std::cout << a[0] << std::endl;
}
I have tried commenting the lines with vector and writing another program in the same file but as soon as I uncomment the vector lines it throws an error on running.
I using VScode and MINgw.