vendredi 24 mars 2017

Vector type String but when initialize with integer

I have below code:

    vector<string> v6{10};
    cout << v6.size() << endl;
    for (int i = 0; i < 10; i++){
     cout << v6[i] << endl;     
    }

Output is in the below picture: http://ift.tt/2mZdThr

Why they print 10 for v6's size. I thought it creates a vector string with the first element is integer. And when I print all value it show something like space

Aucun commentaire:

Enregistrer un commentaire