#include "stdafx.h"
#include <stdio.h>
main()
{ char a;
int m,d;
char c;
while(1)
{
c=getchar();
if((c=='+')||(c=='-')||(c>'0'&&c<'9'))
{
m=0;
switch(c)
{
case '+':
case '-':
{
d=','-c;
a=getchar();
while(a!='\n')
{
m=(m<<3)+(m<<1)+a-'0';
a=getchar();
}
printf("%d\n",d*m);
}
break;
default:
while(c!='\n')
{
m=(m<<3)+(m<<1)+c-'0';
c=getchar();
}
printf("%d\n",m);
}
}
else
{
printf("you input the wrong number\n");
}
}
return 0;
}
----------------解决方案--------------------------------------------------------