dimanche 27 octobre 2019

c++ adding an int to all elements of a vector

I have a vector with integers lets say {1, 2, 3, 4}, how can I add a constant value 10 to each element to modify the vector to be {11, 12, 13, 14}. and the same thing with divides if I wanted to divide each element by an int and modify the vector. I haven't been able to find solutions.

Aucun commentaire:

Enregistrer un commentaire