| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
谢谢,这到底哪里错了?#include<stdio.h>
#include<stdlib.h>
main()
{
char a[30];
int b[30];
int i=0,j=0;
while(j<=30)
{
a[i]='0';
b[j]=0;
j++;
}
while(scanf("%s",&a)!=EOF)
{
int l=strlen(a);
i=0;
while(i<=l)
{
switch (a[i])
{
case 'B':case 'F':case 'P':case 'V':b[i]=1;break;
case 'C':case 'G':case 'K':case 'Q':case 'S':case 'X':case 'Z': case 'J':b[i]=2;break;
case 'D':case 'T':b[i]=3;break;
case 'L':b[j]=4;break;
case 'M':case 'N':b[i]=5;break;
case 'R':b[i]=6;break;
defalt:break;
}
i++;
}
i=0;
while(i<=l)
{
if((i==0)&&(b[i]!=0))
printf("%d",b[i]);
else if((i!=0)&&(b[i]!=b[i-1])&&(b[i]!=0))
printf("%d",b[i]);
i++;
}
printf("\n");
j=0;
while(j<=l)
{
a[i]='0';
b[j]=0;
j++;
}
i=0;
}
system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator