早教吧 育儿知识 作业答案 考试题库 百科 知识分享

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.
▼优质解答
答案和解析
很简单啊,只是做了简单的位变换,要学会自己动手呢~
如果我没猜错应该是考试题目吧···