Pagini recente » Cod sursa (job #2598147) | Cod sursa (job #2529887) | Cod sursa (job #683737) | Cod sursa (job #185188) | Cod sursa (job #1850919)
#include<bits/stdc++.h>
using namespace std;ifstream f("evaluare.in");ofstream g("evaluare.out");char *c;
int F(int x)
{
int R;char o;
if(x==0){R=F(1);for(o=*c;o=='+'||o=='-';o=*c)c++,R=o=='+'?R+F(1):R-F(1);}else
if(x==1){R=F(2);for(o=*c;o=='*'||o=='/';o=*c)c++,R=o=='*'?R*F(2):R/F(2);}else
if(*c=='('){c++;R=F(0);c++;}else for(R=0;isdigit(*c);c++)R=10*R+*c-'0';return R;
}
int main()
{
c=new char[100010];f>>c;g<<F(0);return 0;
}