早教吧作业答案频道 -->其他-->
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...的网友还看了以下:
线性代数 方阵的行列式的性质:请证明方阵的行列式的性质:A,B为方阵,则AB乘积的行列式等于A的行 2020-05-15 …
英语单词辨音找出画()部分读音与其余不同的单词()1.A .kn(ee) B.n(e)ck C.r 2020-05-17 …
··一道简单的数学题,先到的.对的.角D=90度,BD=CD,BO是角DBC的角平分线,CE垂直B 2020-06-03 …
设实数a,b,c,d,e满足(a+c)(a+d)=(b+c)(b+d)=e≠O,且a≠b,那么(a 2020-06-08 …
如图,在正方形ABCD中,E是边CD的中点.(1)用直尺和圆规作O,使O经过点A、B、E(保留作图 2020-07-10 …
英语单词填空1.时间状语:d-r-n-2.场所:b-s-s-o-f-r--e-a-t-e-t3.教 2020-07-14 …
(2014•尤溪县质检)如图1,已知矩形ABCD,E为AD边上一动点,过A,B,E三点作⊙O,P为 2020-07-14 …
8、△ABE中,E在圆O内,A、B在圆O上,OA、OB是定圆内任意两条半径,BE垂直AO于E,EP 2020-07-30 …
选出划线部分不同的一项1.Ahear(ear)B.pear(ear)Cthere(ere)D.whe 2020-10-29 …
这几个字母怎么拼才是单词呢?B-E-E-N-M-O-R-VA-E-R-T-WA-B-C-D-O-P- 2021-02-09 …