Please help me figure out how to decrpyt the message... and help me write it that the uppercase letters encrypt to lower case!
#include <iostream>
using namespace std;
void toLowerCase( char [ ] );
int main()
{
char msg []= "Today a Nobel laureate will visit SAU.";
encrypt (msg);
cout << msg << endl;
}
void encrypt (char msg []){
int key = 15;
int i = 0;
while (msg [i] != '\0'){
if (msg[i] <= 'z' && msg[i] >= 'a'){
if (msg[i] + key <= 'z'){
msg[i] = (char)(msg[i] + key);
}
else {
int d = msg [i] + key - 'z';
msg [i]= (char)'a' + d - 1;
}
}
i ++;
}
}
. Write a function with the following prototype:
void toLowerCase( char [ ] );
The function receives a string as argument and converts all the upper-case letters in the string to lower-case. Any character in the string that is not in upper-case, e.g. lower-case or non-alphabet character will remain unchanged.
2. Write a function that decrypts the message. The function prototype is given below:
void decrypt( char msg[ ] );
3. Write a main function to test your functions in the following steps:
1. Get the original message: Today a Nobel laureate will visit SAU.
2. Call toLowerCase
3. Display the resulting message
4. Call encrypt
5. Display the resulting message
6. Call decrypt
7. Display the resulting message