#include#include #include #include #include
using namespace std; // Wes does the math class Wes : public unary_function { private: int sum; public: Wes() : sum(0) { } void operator()(int x) {sum +=x ;} int total() { return sum; } }; int main() { Wes tside_story = for_each(istream_iterator (cin), istream_iterator (), Wes()); cout << tside_story.total() << endl; return EXIT_SUCCESS; }