vector<string> v{ "123456789", "12345" };
long long result = 0;
for (auto x : v) {
reverse(begin(x), end(x));
result += stoll(x);
}

Of course, you do need to take into consideration whether the summed values will fit in the result. You may want to consider a big number library that allows arbitrary integer lengths.

I also explicitly stated C++11, which you clearly aren't using. :rolleyes: Prior to C++11 it's not as simple, but still doable:

vector<string> v;
long result = 0;
v.push_back("123456789");
v.push_back("12345");
for (vector<string>::iterator it = v.begin(); it != v.end(); ++it) {
string x = *it;
reverse(x.begin(), x.end());
stringstream ss(x);
long temp;
ss >> temp;
result += temp;
}

long long was added in C++11, so now you really need to be careful not to overflow long or use a big number library to avoid overflow.

Read long integers as strings and store the digits of the number in the vector in reverse order.

Then straight C++ won't be enough. The 32-bit limit on long and even 64-bit limit on long long may not be sufficient to store the final value. You need something like GMP or Boost.Multiprecision to extend that limit indefinitely.

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.

This is the result of previous question answered :

Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.