7 like 3 dislike
Superman wants to send a message to Batman. The message is important, so Superman changes it to a set of characters.

Write a complete program that will correctly decode a set of characters into a valid message.

Your program should read a given file of a simple coded set of characters and print the exact message that the characters contain. The code key for this simple coding is a one for one character substitution based upon a single arithmetic manipulation of the printable portion of the ASCII character set.

Hints: The first word of each sentence is '*' !!

 

超人想要傳遞訊息給蝙蝠俠,但因為這是個重要的訊息,所以他將每個句子都改變成一個字集。

請寫一個程式,以將字集轉換回句子,解開他們的訊息!

加密的方式是每個句子的每個字的ASCII經過一個數字的加減,每個句子加減的數字都不同!

提示:每個句子的第一個字都是"*"~

---Example---

Input:

1OL`3'^H`UL('P'HT'RLU[5

4S*RK`O*^Y*^OVV*cY_*KX*SWZY\^KX^*^RSXQ+

+CBUNBO!W!TVQFSNBO;!EBXO!PG!KVTUJDF!JT!WFSZ!WFSZ!WFSZ!HPPE""

Output:

*HEY, WAYNE! I AM KENT.

*I HAVE TO TELL YOU AN IMPORTANT THING!

*BATMAN V SUPERMAN: DAWN OF JUSTICE IS VERY VERY VERY GOOD!!
asked in Introduction to Computer Programming (II) by (16 points)
edited by | 14 views

3 Answers

0 like 0 dislike
Hidden content!
#include * *** * * * *



using namespace std;



int main()

{
* * ** * *** * ****** *** ch, a;
**** * ** *** ** ** ***
* * ** *** * ** ** * * * *** * * * * *
***** ** *** *** * ***** off = ch - '*';
* ** * ** ** * * * ** ***
* * ***** * ** ** * ** * ****** * * **** **** ***** - off);
* ***** *** * ***** * * 0;

}
answered by (96 points)
0 like 0 dislike
Hidden content!
**** *** ***

#include<string>

using namespace std;

int main()

{
*** * * * * **** * i,d;
*** ** * * *** ** * * s;


* ** * *** * *** ** ***** ** *
* **** * * ** ** * *****
********** * ** *** * *** * * * s[i]!='\0'; i++)
*** * * * * * ** * * ** **** * * * ** * ** *******
* **** * ** *** *** *** * * ** * ** * *


** ***** *** * **** *** * * * 0;

}
answered by (-121 points)
0 like 0 dislike
Hidden content!
**** * * *
** * * ** **

using namespace std ;



int main()

{
* *** * *** * * ***** s ;
*** ***** ** (getline(cin,s))
** ** **** * * * * ** **
* ** * * * * * **** *** ** * **** * fix = s[0];
* * ** ****** ** * * *** * **** **** * ** * (int i=0 ; i<s.size() ; i++ )
* * * ***** *** ** *** *** ** ** *
** * **** *** ** * ** *** * * * * **** * * **** **** * ** = s[i]+'*'-fix ;
* * ** * * * *** *** * ** * * ** *****
* **** *** * * * ** * * *** * ** * * << s <<endl ;
** ** *** * * *** * ***
*** * **** * ** * * 0;

}
answered by (16 points)
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.68.65.150
©2016-2018

Related questions

5 like 5 dislike
4 answers
7 like 1 dislike
40 answers
9 like 0 dislike
32 answers
2,966 questions
57,291 answers
28,945 comments
938 users