#include <iostream>
#include <numeric>
using namespace std;
int main()
{
double fArr[] = {-325.33, -0.9, 0.85, -10.55, 5000.56, 52.2};
double fSumAccum = accumulate(fArr, fArr+sizeof(fArr)/sizeof(double), 0);
double fSumLoop = 0.0;
for (size_t i = 0; i < sizeof(fArr)/sizeof(double); i++)
fSumLoop += fArr[i];
cout << "fSumAccum = " << fSumAccum << ", " << "fSumLoop = " << fSumLoop << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bnVtZXJpYz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgCnsKCWRvdWJsZSBmQXJyW10gPSB7LTMyNS4zMywgLTAuOSwgMC44NSwgLTEwLjU1LCA1MDAwLjU2LCA1Mi4yfTsKCQoJZG91YmxlIGZTdW1BY2N1bSA9IGFjY3VtdWxhdGUoZkFyciwgZkFycitzaXplb2YoZkFycikvc2l6ZW9mKGRvdWJsZSksIDApOwoJCglkb3VibGUgZlN1bUxvb3AgPSAwLjA7Cglmb3IgKHNpemVfdCBpID0gMDsgaSA8IHNpemVvZihmQXJyKS9zaXplb2YoZG91YmxlKTsgaSsrKQoJCWZTdW1Mb29wICs9IGZBcnJbaV07CgkJCgljb3V0IDw8ICJmU3VtQWNjdW0gPSAiIDw8IGZTdW1BY2N1bSA8PCAiLCAiIDw8ICJmU3VtTG9vcCA9ICIgPDwgZlN1bUxvb3AgPDwgZW5kbDsKCglyZXR1cm4gMDsKfQ==