问题
填空题
以下程序运行时输出到屏冪的结果中第一行是(),第二行是()。
#include
#include
Void compute(char*s)
{int t,r,
Char op;
For(r=0;isdigit(*s);s++) /*isdigit(*s)判断S指向的字符是否为数字字符*/
R=r*10+*s-‘0’;
While(*s)
{op=*s++;
For(t=0;isdigit(*s);s++)
T=t*10+*s-‘0’;
Switch(op)
{case’+’:r=r+t;break;
Case’-’:r=r-t;break;
Case’*’:r=r*t;break;
Case’/’:if(t)r=r/t;
else{puts(devide enor);return;}
}
}
Printf(%d\n,r);
}
Void main()
{
compute(12+6-19+2);
Compute(12/6*19/2);
}
答案
参考答案:1;19