解题思路:
将电码用数组装起来
注意事项:
注意:转换出来的是小写字母
参考代码:
#include
#include
char Table[26][7]={"*-","-***","-*-*","-**","*","**-*","--*","****",
"**","*---","-*-","*-**","--","-*","---","*--*",
"--*-","*-*","***","-","**-","***-","*--","-**-","-*--","--**"};
int main()
{
char buf[1000],tmp[7];
int i=0,j=0,k;
gets(buf);
i=0;
for(i=0;i
{
while(buf[i]!='|'&&buf[i]!='\0')
tmp[j++]=buf[i++];
tmp[j]='\0';
j=0;
for(k=0;k<26;k++)
{
if(strcmp(Table[k],tmp)==0)
{
printf("%c",k+97);
break;
}
}
}
return 0;
}