早教吧作业答案频道 -->其他-->
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,C,D,E,F共6位同学排在一起拍照A说他左边第2人D,第4人是C;C说他右边第3人士E, 2020-03-31 …
已知a+b+c=H a+b+e=J a+d+e=K b+c+d=M c+d+e=N 求a=?b=? 2020-05-16 …
A、B、C、D、E、F是初中化学中的常见物质,且均含有一种相同的元素,其中A为单质,B、C、E为氧 2020-06-12 …
A,B,C,D,E5个人参加一个国际会议,其中,1,B和C他们讲西班牙语,但是和D在一起的时候他们 2020-06-12 …
BCDEF/A等于1/4,ACDEF/B等于1/2,ABDEF/C等于1,ABCEF/D等于2,A 2020-06-24 …
A、B、C、D、E五人坐在一起聊天,小明想知道这五个人的年龄和.可五人都没有直接回答.E说:“A、 2020-07-18 …
如图,将菱形ABCD沿对角线BD折起,使得C点至C′,E点在线段AC′上,若二面角A-BD-E与二 2020-07-19 …
(2012•开封二模)如图,将菱形ABCD沿对角线BD折起,使得C点至C′,E点在线段AC′上,若 2020-07-24 …
晚上天黑,有一座桥,有5个人A,B,C,D,E要过此桥,现有一盏灯只能亮30秒.A过次桥要1秒,B要 2020-11-08 …
A,B,C,D,E五个人干一项工作:A、B、C、D、E五个人干一项工作,若A、B、C、D、四人一起干 2020-11-27 …