Taking input from user

void main(){
int n;
cin>>n;
vector d;
for(int i=0;i<n;i++)
cin>>d;
}
can we use this or i have to use push_back.v as it append element at the last of the container.
can we compute the size of the v through sizeof(v)/sizeof(int) as in the case of array

hello @vikash3303

if u have defined vector of size n .
like ->
vector< int > d(n);
then u can use indexing cin>>d[i];

if u havent mentioned the size then u need to use push_back.

it will give some output but i m not sure whether that will be correct or not.

vector has two function to get its size ( length() and size() ) , so use these functions