// Online C++ compiler to run C++ program online #include #include #include #include double factorial(double val){ double base=1.0; for(double i=0.0;ieval()+o2->eval(); } if(sym=='-'){ return o1->eval()-o2->eval(); } if(sym=='*'){ return o1->eval()*o2->eval(); } if(sym=='/'){ return o1->eval()/o2->eval(); } if(sym=='%'){ return (double)((int)(o1->eval())%(int)(o2->eval())); } return o1->eval(); } }; bool is_number(const std::string& s){ try { std::stod(s); } catch(std::exception e){ return false; } return true; } double eval_expression(std::string ops){ std::string token; std::vector tokens; std::istringstream iss(ops); while (std::getline(iss, token, ' ')) { tokens.push_back(token); } double o1=0.0; double o2=0.0; bool o1_passed=false; char cur_simbol=' '; for(size_t i=0;i