int main()
{
char opt,eqn[15];
int a,b,c,counter=0,r;
//freopen("in.txt","r",stdin);
while(gets(eqn))
{
//scanf("%s",eqn);
if(sscanf(eqn,"%d%c%d=%d",&a,&opt,&b,&r)^4)
continue;
switch(opt)
{
case '+':
c=a+b;
break;
case '-':
c=a-b;
break;
}
if(!(r^c)) counter++;
}
printf("%d\n",counter);
return(0);
}
No comments:
Post a Comment