早教吧作业答案频道 -->其他-->
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...的网友还看了以下:
已知M是反比例函数y=x分之k(k≠0)图象上一点.过点M分别向x轴和y轴引垂线,如果它们与已知M 2020-04-08 …
1.约分后M的平方加2M减3的差分之M的平方减3M加2的和等于()2.已知M=M分之1,求代数式M 2020-05-13 …
一个作匀加速直线运动的物体,测得它在前2秒内的位移是4米,经8秒后再测定,测得它在6秒内的位移是4 2020-05-22 …
由牛顿第二定律表达式F=ma可知()A.质量m与合外力F成正比,与加速度a成反比B.合外力F与质量 2020-06-10 …
若m加n减p等于0,则m乘以n分之1减p分之1的差加上n乘以m分之1减p分之1的差减p乘以m分之1 2020-06-20 …
如图所示甲、乙两套装置所用滑轮质量均相等,用它们分加紧将所挂重物在相等时间内竖直向上匀速提升相同高 2020-07-03 …
已知直线l1:y=mx+1,l2:x=-my+1,其中|m|≤1,设l1,l2的交点为P,它们分别 2020-07-13 …
分数m/n,当m=()时,它的分数值是0;当n=()时,它的分数值是m;当m=()时,就成为这个分 2020-07-21 …
假设两套完全相同的(如图甲所示)加热装置,两套装置的试管中分别装有少量的相等体积的M固体和N固体. 2020-07-22 …
由牛顿第二定律表达式F=ma可知()A.质量m与合外力F成正比,与加速度a成反比B.合外力F与质量 2020-07-22 …