标签:clu bre ase using col cas nbsp std style
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 char a[20]; 5 using namespace std; 6 int js(int x,int y,char f) 7 { 8 switch(f) 9 { 10 case ‘+‘:cout<<x+y;break; 11 case ‘-‘:cout<<x-y;break; 12 case ‘*‘:cout<<x*y;break; 13 case ‘/‘:cout<<x/y;break; 14 case ‘%‘:cout<<x%y;break; 15 } 16 17 } 18 int main() 19 { 20 gets(a); 21 int len=strlen(a); 22 int b[5],j=0,x,y; 23 char f; 24 for(int i=0;i<len;i++) 25 { 26 if(a[i]>=‘0‘&&a[i]<=‘9‘)b[j++]=a[i]-‘0‘; 27 else if (a[i]!=‘ ‘)f=a[i]; 28 } 29 x=b[0]*10+b[1]; 30 y=b[2]*10+b[3]; 31 js(x,y,f); 32 return 0; 33 }
标签:clu bre ase using col cas nbsp std style
原文地址:http://www.cnblogs.com/tflsnoi/p/7967516.html