#include #include using namespace::std; // calculate the expression "lhs oprhs"double calculate(double &, char &,double &);// decide the calculate orderint compare(char, char); int main(void){ char op1, op2; double lhs, rhs, add; cout > lhs >> op1 >> rhs) { // if op2 is blank, exit the loop while ((op2 = cin。
get()) != '
') { cin >> add; // compare the calculate order // through the if - else, the expression will // always be "lhs op1 rhs op2 add" if (compare(op1, op2) >= 0) { lhs = calculate(lhs, op1, rhs); op1 = op2; rhs = add; } else { rhs = calculate(rhs, op2, add); } } // output the result as scientific cout