这个简易计算器怎么运行不了??
#include<iostream>#include<stdio.h>
int main(int argc,char*argv[])
{
int c,d;
char e;
char*p;
p=argv;
c=number(p);
e=*p;
d=number(p);
Result();
}
int number(char*p)
{
int sum=0,m;
while(*p>='0'&&*p<='9')
{
m=*p;
sum=sum*10+m;
p++;
}
p++;
return sum;
}
void Result(char e)
{
int result;
switch(e)
{
case '+':
result=c+d;
cout<<result<<endl;
break;
case '-':
result=c-d;
cout<<result<<endl;
break;
case '*':
result=c*d;
cout<<result<<endl;
break;
case '/':
if(d==0)
{
cout<<error!!!<<endl;
break;
}
else
{
result=c/d;
cout<<result<<endl;
break;
}
default:
cout<<"error"<<endl;
}
}