Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5. A company has have asked you to write a program that encrypts their data so t

ID: 3624148 • Letter: 5

Question

5. A company has have asked you to write a program that encrypts their data so that it can 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 7) modulus
10. Then, swap the first digit with the third, swap the second digit with the
forth and print the encrypted integer.

WE HAVE USED RELATIONAL,LOGICAL,ASSIGNMENT OPERATORS etc,IF ELSE,FOR LOOP,WHILE LOOP,DO-WHILE LOOP ETC, SO PLZ CONFINE UR RESPONSE TO THESE!!! THANKS

Explanation / Answer

please rate - thanks

#include<iostream>
using namespace std;
int main()
{int num,first,second,third,fourth;
cout<<"enter a number-must be 4 digits: ";
cin>>num;
while(num<1000||num>9999)
    {cout<<"must have 4 digits ";
     cout<<"enter a number-must be 4 digits: ";
     cin>>num;
     }
first=(num/1000+7)%10;
num=num%1000;
second=(num/100+7)%10;
num=num%100;
third=(num/10+7)%10;
fourth=(num%10+7)%10;
num=third*1000+first*10+fourth*100+second;
cout<<"The encrypted number is "<<num<<endl;
system("PAUSE");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote