A company wants to transmit data over the Internet but is concerned about the se
ID: 3617163 • Letter: A
Question
A company wants to transmit data over the Internet but is concerned about
the security of the sensitive data. All of the data are transmitted as
four-digit integers. The company asked you to write a program that encrypts
the data so that it
can be transmitted securely. Your program should read a four-digit integer and
encrypt it as follows: Replace each digit (the sum of that digit plus 7)
modulus 10. Then, swap the first digit with the third, swap the second with
the fourth and print the
encrypted integer. Add decryption functionality to your program above
that inputs an encrypted four-digit integer and decrypts it to form
the original number.
Expected Output:
(i)
Enter a four-digit number: 3456
Encrypted number is 2301
Enter an encrypted number: 2301
Decrypted number is 3456
(ii)
Enter a four-digit number: 0005
Encrypted number is 7277
Enter an encrypted number: 7277
Decrypted number is 5
Explanation / Answer
please rate - thanks #include using namespace std; int main() {int num,n1,n2,n3; coutnum; n1=(num%10+7)%10; num/=10; n2=(num%10+7)%10; num/=10; n3=(num%10+7)%10; num=(num/10+7)%10; num=n2*1000+n1*100+num*10+n3; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.