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

1 #include<iostream> 2 #include<string> 3 4 using namespace std; 5 6 int main()

ID: 3938790 • Letter: 1

Question

1 #include<iostream>
2 #include<string>
3
4 using namespace std;
5
6 int main()
7 {
8 char message[100];
9 char output[100];
10
11 int key, count;
12
13 cout << "Enter encrypted message : ";
14 cin.getline(message,100);
15
16 for(key = 1; key <= 100; key++)
17 {
18 for(count = 0; message[count] !=''; count++)
19 {
20 if(message[count] - key < 32)
21 output[count] = message[count] - key + 127 - 32;
22 else
23 output[count] = message[count] - key;
24 }
25
26 cout << "Decrypted message using Key " << key << " : ";
27 cout << output << endl;
28 }
29
30 }

can you help me separate these into 3 functions? I keep getting errors.

Explanation / Answer

#include 02 #include 03 using namespace std; 04 int main() 05 { 06     string message, decrypt; 07     int m, d, shift, n = 0; 08     ifstream input; 09       10     //read encrypted message from "secret.dat" 11     input.open("secret.dat"); 12     getline(input, decrypt, '&'); 13     getline(input, message); 14     input.close(); 15       16     cout 90) 53                               decrypt[i] = 32; 54                                 55                            if (decrypt[i] + shift < 48) 56                              decrypt[i] = 32; 57                            if (decrypt[i-1] + 4 == decrypt[i]) 58                               decrypt[i] = 32; 59                             60                            } 61                62             if ((decrypt[i] > 47) && (decrypt[i] < 58)) 63              if(decrypt[i-1]==32) 64              decrypt[i+1]=32;      65 66     }   67     cout