Write a C++ function to encrypt a string :?

Write a C++ function to encrypt a string as follows : - Take the characters at odd indexes and perform a string then take the other characters at even indexes. - Do the previous step n times. Example: If the string is: "This is a test!" and n = 1; then the output will be: "hsi etTi sats!" If... show more Write a C++ function to encrypt a string as follows :

- Take the characters at odd indexes and perform a string then take
the other characters at even indexes.
- Do the previous step n times.

Example:
If the string is: "This is a test!" and n = 1; then the output will be:
"hsi etTi sats!"

If n = 2 the output will be:
"s eT ashi tist!"

Header file: void Encrypt (char s [ ], int n);

Call the function in your main and print the new string after calling the
function.

Note:
Your code should be readable and general (i.e. applicable to any string size)

Please help me out in this, thank you in advance!
4 answers 4