| ||||||||||
| 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 | |||||||||
哥哥姐姐们 告诉我哪错了啊 HELP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#include <iostream.h>
void main()
{
int i;
char ch[1000];
int a[1000];
while(1){
for(i=0;;i++)
{
if(ch[0]=='\n')
goto end;
ch[i]= cin.get();
if(ch[i]=='\n')
break;
}
i=0;
int k=0;
while(ch[i]!='\n')
{
if((ch[i]=='B'||ch[i]=='F'||ch[i]=='P'||ch[i]=='V')&&ch[i]!=ch[i-1])
{
a[k]=1;
k++;
}
else if((ch[i]=='C'||ch[i]=='G'||ch[i]=='J'||ch[i]=='K'||ch[i]=='Q'||ch[i]=='S'||ch[i]=='X'||ch[i]=='Z')
&&ch[i]!=ch[i-1])
{
a[k]=2;
k++;
}
else if((ch[i]=='D'||ch[i]=='T')&&ch[i]!=ch[i-1])
{
a[k]=3;
k++;
}
else if((ch[i]=='L')&&ch[i]!=ch[i-1])
{
a[k]=4;
k++;
}
else if((ch[i]=='M'||ch[i]=='N')&&ch[i]!=ch[i-1])
{
a[k]=5;
k++;
}
else if((ch[i]=='R')&&ch[i]!=ch[i-1])
{
a[k]=6;
k++;
}
i++;
}
for(i=0;i<k;i++)
cout<<a[i];
cout<<endl;
}
end:;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator