jeudi 30 novembre 2017

Initialilze a array of vectors with zero in C++

I want a array of vectors with 0 as a single element in all the individual vectors. Is there a much more efficient way? does this work?

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){

        int lastAnswer = 0;
        int n,q;
        cin >> n >> q;
        vector<int> seqArr[n];
        for(int i=0;i<n;i++)
        {
                fill(seqArr[i].begin(),seqArr[i].end(),0);
        }
return 0;
}

Aucun commentaire:

Enregistrer un commentaire