online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <vector> #include <string> using std::cout; using std::endl; using std::vector; using std::string; struct Employee { string name; string id; int vacation; double salary; }; //total salary or total vacation days? //sum(staff.begin(),staff.end(),0); template<class Iter,class T,class Op> T reduce (Iter start,Iter end,T init,Op op){ T result = init; while (start != end) { result = op(result,*start ); start++; } return result; } int main(){ vector<Employee>staff = {{"t", "121221", 1, 1.0}, {"s", "121221", 2, 2.0} }; double sum_salries = reduce(staff.begin(),staff.end(),0.0, [](double s,Employee e){return s+e.salary;}); double max_salary = reduce(staff.begin(),staff.end(),0.0, [](double s,Employee e) {return s > e.salary?s:e.salary; } ); cout << "Sum of sum_salries:" << sum_salries << "\n max_salary:"<< max_salary << endl; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue