Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

bunyonb Group Title

A company wants to transmit data over the telephone lines. All their data is transmitted as four-digit integers. write a program that will encrypt their data so that it may be transmitted more securely. Your program should read a four digit number and encrypt as follows: replace each digit by the remainder after the sum of that digit plus 7 is divided by 10. Then swap the first digit with the third, and swap the second digit with the fourth. Then print the encypted integer. Write a seperate program that inputs an encrypted four-digit integer and decrypts it to form the original number

  • one year ago
  • one year ago

  • This Question is Closed
  1. bunyonb Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    You need to use While Loop too

    • one year ago
  2. bunyonb Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Here is what i have so far... #include <iostream> using namespace std; int main(){ int num=0;int encrypted_num=0;int digit[3]; cout<< " Input: " cin>>num; if (num> 1000 || num<1000){ cout<< "

    • one year ago
  3. Shadowys Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    you might want to use an array to keep the numbers. and......is the while loop really required?

    • one year ago
  4. Shadowys Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    #include <iostream> #include <math.h> using namespace std; int main() { int num[4]; int a,b,c; cin >>a; if (a<10000) { if(a>1000) { for(int i=0; i<4;i++){ b=pow(10, i+1); num[i]=a%b; a-=a%b; if (i>0){ c=pow(10,i); cout<<num[i]; num[i]/=c; cout<<"h"; cout<<num[i]; } } } } else { cin.clear(); while (cin.get() != '\n') ; cout<<"hello"; cin>>a; } for(int i=0;i<4;i++){ num[i]+=7; num[i]=num[i]%10; } cout<<num[0]; cout<<num[1]; cout<<num[2]; cout<<num[3]; }

    • one year ago
  5. Shadowys Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    sample code for using a array to keep the numbers for easy reference. to interchange the values, keep the element in another symbol before assigning it away.

    • one year ago
  6. bunyonb Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Too late man. I failed

    • one year ago
  7. Shadowys Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    sigh. i guess that's no help then. LOL good luck next time

    • one year ago
  8. bunyonb Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Hope so

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.