I wanted to add elements in vector, not complicated at all.
#include <iostream>
#include <vector>
int main(){
int n;
std::cin>>n;
std::vector<int> arr(n);
for(int i=0;i<n;i++){
arr.push_back(i);
}
for(int i=0;i<n;i++){
std::cout<<arr[i];
}
std::cout<<"\n";
std::cout<<arr.capacity()<<"\n";
std::cout<<arr.size()<<"\n";
}
But the problem is when I compile the size and capacity are 2 times bigger than the size i put in code(in this case size is n), and n zeros are printed out.