Answer:
See Explanation Below
Step-by-step explanation:
// Program is written in C++ Programming Language
// Comments are used for explanatory purpose
// Program starts here
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
// Declare 2 string variables to store the secret message and to store the encrypted text
string message, result;
// Prompt user to enter a secret message
cout<<"Enter a secret message: ";
cin>message;
// Convert the input string to char array
int n = message.length();
char char_array[n + 1];
strcpy(char_array, message.c_str());
// Initialise result
result = "";
// Declare an array of all possible alphabets a-z
char possible[26] = { 'a','b','c','d','e','f','g,','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',w','x','y','z'};
// Generate output string
// Start by getting string position
int count = 0;
while(count<n)
{
// If current character is blank or !
if(char_array[count] = '!' || char_array[count] = ' ')
{
result+=char_array[count];
}
else
{
for(int I = 0; I<26; I++)
{
if(char_array[count] = possible[I])
{
result+=possible[25-I];
}
}
}
count++;
}
// No output required; the program stops here
return 0;
}
// End of program