早教吧作业答案频道 -->其他-->
C++抱歉现在只有5分了.problem2和problem3是一起的,就是程序顺序可能换了下,附加的问题可能就是把它们合起来吧我一定追加积分!Problem2Acompanywantstotransmitdataoverthetelephone,buttheyareconcern
题目详情
C++ 抱歉现在只有5分了.
problem2 和problem3 是一起的,就是程序顺序可能换了下,附加的问题可能就是把它们合起来吧 我一定追加积分!
Problem 2
A company wants to transmit data over the telephone,but they are concerned that their phones may be tapped.All of their data is transmitted as four-digit integers.They have asked you to write a program that will encrypt their data so that it may be transmitted more securely.Your program should read a four-digit integer and encrypt it as follows:Replace each digit by (the sum of that digit plus 5) modulus 10.Then,swap the first digit with the second,and swap the third digit with the fourth.Then print the encrypted integer.
Here is the beginning of a sample dialogue (user input is in bold):
Please enter a number to be encrypted:1234
The encrypted value is:
Problem 3
Write a separate program than inputs an encrypted 4-digit number (encrypted using mp6b.cpp),and decrypts it to its original form.
Here is the beginning of a sample dialogue (user input is in bold):
Please enter a number to be decrypted:
The decrypted value is:1234
Bonus Points (Optional)
You can receive 25 bonus points for implementing the following:
You've received a handout that explains the use of the argv and argc parameters that may be used with the main function.argv and argc allow the user to specify information to an executable file (.exe file) from the DOS command line.
Take your implementations of mp6b and mp6c and allow the user to specify the values to be encrypted on the command line.The interaction would look as follows (as viewed from the DOS command line (C:\ prompt).User input is in bold:
mp6b 1234
The encrypted number is
mp6c
The decrypted value is 1234
Hint:You will need to use the atoi function in stdlib.h to accomplish this.
problem2 和problem3 是一起的,就是程序顺序可能换了下,附加的问题可能就是把它们合起来吧 我一定追加积分!
Problem 2
A company wants to transmit data over the telephone,but they are concerned that their phones may be tapped.All of their data is transmitted as four-digit integers.They have asked you to write a program that will encrypt their data so that it may be transmitted more securely.Your program should read a four-digit integer and encrypt it as follows:Replace each digit by (the sum of that digit plus 5) modulus 10.Then,swap the first digit with the second,and swap the third digit with the fourth.Then print the encrypted integer.
Here is the beginning of a sample dialogue (user input is in bold):
Please enter a number to be encrypted:1234
The encrypted value is:
Problem 3
Write a separate program than inputs an encrypted 4-digit number (encrypted using mp6b.cpp),and decrypts it to its original form.
Here is the beginning of a sample dialogue (user input is in bold):
Please enter a number to be decrypted:
The decrypted value is:1234
Bonus Points (Optional)
You can receive 25 bonus points for implementing the following:
You've received a handout that explains the use of the argv and argc parameters that may be used with the main function.argv and argc allow the user to specify information to an executable file (.exe file) from the DOS command line.
Take your implementations of mp6b and mp6c and allow the user to specify the values to be encrypted on the command line.The interaction would look as follows (as viewed from the DOS command line (C:\ prompt).User input is in bold:
mp6b 1234
The encrypted number is
mp6c
The decrypted value is 1234
Hint:You will need to use the atoi function in stdlib.h to accomplish this.
▼优质解答
答案和解析
很简单啊,只是做了简单的位变换,要学会自己动手呢~
如果我没猜错应该是考试题目吧···
如果我没猜错应该是考试题目吧···
看了C++抱歉现在只有5分了.pr...的网友还看了以下:
一欧姆表有4个挡位,分别为×1Ω挡、×10Ω挡、×100Ω挡和×1kΩ挡.现用它来正确测量一未知电 2020-04-07 …
在一次足球比赛中,第一轮,实行单循环赛制,在每场比赛中赢者计两分,负者计O分,如果平局,双方各计一 2020-04-07 …
如图,射线PG平分∠EPF,O为射线PG上一点,以O为圆心,10为半径圆O,分别与∠EPF两边相交 2020-04-26 …
下图是N、O、F三种元素基态原子电子排布的轨道表示式(如有需要,可以利用本练习中出现过的信息)。试 2020-05-14 …
下图是N、O、F三种元素基态原子电子排布的轨道表示式。试回答下列问题(1)请认真分析去发现,N、O 2020-05-14 …
化学键的键能是形成(或断开)1mol化学键时释放(或吸收)的能量.已知白磷和P4O6的分子结构如下 2020-05-15 …
快 如图,AOB为一条在O处拐弯,点P如图,AOB为一条在O处拐弯,点P表示某村庄,现在要修一条从 2020-05-16 …
分数b分之a(b不等于0,且a、b为自然数),当a是( )时,这个分数也是它的分数单位.当a是( 2020-05-16 …
如图,射线PG平分∠EPF,O为射线PG上一点,以O为圆心10为半径作圆O,分别与∠EPF两边相交 2020-05-20 …
计算化学反应热.已知白磷是正四面体的分子,当与氧形成P4O10时,每两个磷原子之间插入一个氧原子, 2020-05-23 …