samedi 31 octobre 2015

How to access elements of array and vector repeatedly in c++?

I have a vector of int V'

vector<int> V={2,4,5,6,7};

I want to iterate through vector such that if index is greater than size of vector it should return again some element in vector for example V.size() is 5 if I enter V[6] I need result to return 4,if I enter v[5] it should return 2..... can I also do it with arrays?? Thanks in advance..

Aucun commentaire:

Enregistrer un commentaire