字母转化为摩尔斯电码
#include <stdio.h>int main(void)
{
char arr[300] = " AABBB B B BBABAA BBA B AAABAB AAAA BBABBA BB AAA BB AA BB AAAA AB BAABAAAAAAAABBAAAABB BBA AAAAB AAAAA AAAAA AAABB BB AAABB ABAA BAAA ABBBB AAAAA ABBBB AAAB BA ABBBB BBBAAA BBA AB ABAA AABA BBAABB AAA BA BBB AA B AB ABAA AAB B AB ABA BBA BA BBB BABA";;
char change[300];
for (int i = 0; i < 253; i++)
{
if (arr[i] == 'A')
{
change[i] = '.';
}
if (arr[i] == 'B')
{
change[i] = '-';
}
else
{
change[i] = ' ';
}
}
for (int i = 0; i < 253; i++)
{
printf("%c", change[i]);
}
return 0;
}
//运行输出结果为啥没有'.'只出现了’-‘???