首页 > 其他 > 详细

水题--莫斯电码翻译

时间:2017-01-17 22:56:35      阅读:234      评论:0      收藏:0      [点我收藏+]

 示例输入输出:(有关莫斯电码部分请自行百度)

 技术分享

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     string s[]= {"*-","-***","-*-*","-**","*","**-*","--*","****","**","*---","-*-","*-**","--","-*","---","*--*","--*-","*-*","***","-","**-","***-","*--","-**-","-*--","--**"};
 6     string s1;
 7     while(cin>>s1)
 8     {
 9         for(int i=0; i<s1.length(); i++)
10             if(s1[i]==|)s1[i]= ;
11         string a;
12         for(istringstream sin(s1); sin>>a;)
13         {
14             for(int i=0; i<26; i++)
15             {
16                 if(a==s[i])printf("%c",i+97);
17             }
18         }
19         cout<<endl;
20     }
21     return 0;
22 }

 

水题--莫斯电码翻译

原文:http://www.cnblogs.com/A--Q/p/6294799.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!