专题一 字符串处理
A1001 Format(20)
#include<cstdio> int main () { int s[11]; int a,b,sum; scanf ("%d %d",&a,&b); sum=a+b; if (sum<0) { printf ("-"); sum=-sum; } int z,top=0; if (sum==0) { s[top++]=0; } while (sum!=0) { s[top++]=sum%10; sum/=10; } for (int i=top-1;i>=0;i--) { printf ("%d",s[i]); if (i%3==0&&i!=0) printf (","); } return 0; }
A1005 Spell It Right(20)
#include<cstdio> int main () { char s[10][6]={"zero","one","two","three","four","five","six","seven","eight","nine"}; char q[105]; int w=0; while ((q[w]=getchar())!=' ') w++; q[w]='