Problem VII I: What is wrong with the followingstatements? a) cout << ++x++; b)
ID: 3615544 • Letter: P
Question
Problem VIII: What is wrong with the followingstatements?
a)cout <<++x++;
b)cout <<x++ + 1;
c)cout <<x++ + ++1;
Problem X: A militarycompany wants to transmit data over the telephone, but they areconcerned that their phones may be tapped. All of their data istransmitted as four-digit integers. They have asked you to write aprogram that encrypts their data so that it may be transmitted moresecurely. Your program should read a four-digit integer and encryptit as follows: Replace each digit by: (the sumof that digit plus 7) modulus 10. Then, swapthe first digit with the third, swap the second digit with thefourth, and print the encrypted integer. Your screen should appearas follows:
Enter a four-digit number to be encrypted:1009
Encrypted number is 7687
Write a separate program that inputs an encryptedfour-digit integer, and decrypts it to form the originalnumber.
Enter a four-digit encrypted: 7687
Explanation / Answer
please rate - thanks
Problem VIII: What is wrong with the followingstatements?
a)cout <<++x++; definition of instruction is 1 or the other not both
b)cout << x++ +1; nothing -try it it works, as long as you have the spaces separating theoperators
c)cout << x++ + ++1; nothing -same as other
#include<iostream>
using namespace std;
int main()
{int num,d1,d2,d3,d4;
cout<<"enter a number: ";
cin>>num;
d1=((num%10)+7)%10;
num/=10;
d2=((num%10)+7)%10;
num/=10;
d3=((num%10)+7)%10;
d4=((num/10)+7)%10;
num=d2*1000+d1*100+d4*10+d3;
cout<<"number encrypted: "<<num<<endl;
d1=((num%10)+3)%10;
num/=10;
d2=((num%10)+3)%10;
num/=10;
d3=((num%10)+3)%10;
d4=((num/10)+3)%10;
num=d2*1000+d1*100+d4*10+d3;
cout<<"number decrypted: "<<num<<endl;
system("pause");
return 0;
}
#include<iostream>
using namespace std;
int main()
{int num,d1,d2,d3,d4;
cout<<"enter a number: ";
cin>>num;
d1=((num%10)+3)%10;
num/=10;
d2=((num%10)+3)%10;
num/=10;
d3=((num%10)+3)%10;
d4=((num/10)+3)%10;
num=d2*1000+d1*100+d4*10+d3;
cout<<"number decrypted: "<<num<<endl;
system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.