Iterate till end and take the sum
for(std::vector<int>::iterator it = vector.begin(); it != vector.end(); ++it) sum += *it;
Or you can use std::accumulate(vector.begin(), vector.end(), 0); if needs a library function.
std::accumulate(vector.begin(), vector.end(), 0);
I want to pass a string over the network, After Coding and Decoding How will i make sure that this is the same string ?