
Originally Posted by
Hobson
I was getting incorrect results although it was guaranted there should be no overflow for
unsigned long long type. Still, result was incorrect. Find an error and get a rep point from me

I know! 
this is pretty simple to me, but I am not a pro
.
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s = "Testing";
//iterate through string backwards
for(size_t pos = s.length() - 1; ; --pos) {
cout << s[pos] << endl;;
if(pos == 0) break;
}
}
Code:
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
int main()
{
vector<unsigned long long> vec;
vec.push_back(123456789012LL);
vec.push_back(987654321098LL);
unsigned long long result = accumulate(vec.begin(), vec.end(), 0LL);
cout << result;
}
Do you want an explanation too?