24 game: Difference between revisions

Line 715:
 
=={{header|C++}}==
{{works with|C++0x11}}
 
This uses the upcoming C++0x11 standard to simplify several parts of the code. Input is given in RPN format.
 
<lang cpp>#include <random>
Line 750:
}
else if(c == '+')
op([](double a, double b)->double {return a+b;});
else if(c == '-')
op([](double a, double b)->double {return a-b;});
else if(c == '*')
op([](double a, double b)->double {return a*b;});
else if(c == '/')
op([](double a, double b)->double {return a/b;});
}
 
Line 815:
cout << "Error: " << e << endl;
}
return 0;
}</lang>
 
Anonymous user