include
include
using namespace std;
int main(){
char op;
long long int res,a;
long long int t;
cin>>t;
while(t--){//for t test cases
res=0;
op=0;
scanf("%lld",&res);//first operand
while(1){
scanf( "%s", &op);// operator read
if(op =='=')//breaking condition
break;
scanf("%lld",&a); //second operand
// * = 42,+ =43, - =45,/=47 ascii values
//* + - / ....-6...-5 ...-3...-1
cout<<op;//i am getting correct ans if i am using this cout function ....i dont understand y?
int x=op;
if(x==43)
res=res+a;
else if(x==45)
res=res-a;
else if(x==42)
res=res*a;
else
res=res/a;
//cout<<"res="<<res<<endl;</p>
<pre><code>}
cout<<res<<endl;
}
}</code></pre>
<p>input:<br/>9</p>
<p>1 + 1 * 2 =</p>
<p>29 / 5 =</p>
<p>103 * 103 * 5 =</p>
<p>50 * 40 * 250 + 791 =</p>
<p>234 + 23423 + 22 * 234234 / 32 =</p>
<p>6161 + 616 + 5 + 1 / 6 - 5 / 1 * 6 - 51 * 651 =</p>
<p>6 / 84 - 64 - 84 - 8 - 4 / 8 - 4 / 96848 + 4 / 8494 + 9 * 4 / - 84 =</p>
<p>8 / 4 * 8 + 4 / 984 - 984 - 94 + 989 / 8 / 98 / 98 + 9 * 8 / 98 / 9 * 8 - 898 / 98 / 98 =</p>
<p>6 + 46 + 0 / 45 * 06464 * 4 * 607 * 60 * 8 + 4 * 564 * 64 * 06 * 4 + 4 - 64 - 64 * 6 =</p>
<p>output:<br/>+*4<br/>/5<br/>**53045<br/>**+500791<br/>++*/173325840<br/>+++/-/*-*4361049<br/>/----/-/+/+*/80<br/>/*+/--+///+<em>//</em>-//0<br/>++/***<em>*+****+--</em>39157308965338392<br/>output if i take out cout<<op;<br/>is like below<br/>0<br/>0<br/>0<br/>768<br/>170522112<br/>2833152<br/>0<br/>-256<br/>-3072</p>