评价
真麻烦
**简单的优化了一下
拿走不谢喔 ovo
代码
#include<iostream>
#include<string>
using namespace std;
string ma[120];//装对于序号的摩斯密码
void zhuang(){
ma['?']={"..--.."};
ma['/']={"-..-."};
ma['.']={"-.-.-."};
ma['-']={"-....-"};
ma['(']={"-.--.-"};
ma[')']={"-.--.-"};
}
string zm[27]={
".-",
"-...",
"-.-.",
"-..",
".",
"..-.",
"--.",
"....",
"..",
".---",
"-.-",
".-..",
"--",
"-.",
"---",
".--.",
"--.-",
".-.",
"...",
"-",
"..-",
"...-",
".--",
"-..-",
"-.--",
"--..",
"",
};
string num[10]={
".----",
"..---",
"...--",
"....-",
".....",
"-....",
"--...",
"---..",
"----.",
"-----",
};
int main(){
zhuang();
for(int p='A';p<='Z';p++){
ma[p]=zm[p-'A'];
}
for(int p='0';p<='9';p++){
ma[p]=num[p-'A'];
}
string str;int i=0;
while(cin>>str){
if(i==1)cout<<"***";
i=1;
for(int j=0;j<str.size();j++){
if(j!=0)cout<<"*";
cout<<ma[str[j]];
}
}cout<<"\n";
}