Challenge resolved with the intent of training the use of strings in C language. link to the challenge page
The program was made with the intention of encrypting a text written by the user using the Caesar's cipher method on which each letter of the plaintext is replaced by another letter by advancing it some fixed positions down the alphabet, wrapping around form z back to a. For example:
The caesar cipher of the letter
a
with 1 shift isb
The caesar cipher of the letterd
with 15 shift iss
The caesar cipher of the plaintextfusion
with 6 shift islayout
The program will accpet lowercase and uppercase letters and keep special characters (like: !,.;@#$%áú^) and spaces as is.
Programming language used: C
Program date: June 2021.
Made by: Ana C Maia Atala. 📧 @ ana.atala@unemat.br
The program hasd the following basic logic steps:
- The user will input their desired plaintext and what shift they want their text to be encrypted on.
- The program will read the text as a string and scan it in a
for loop
.- For each character in the string, the program will determine by using it's ASCII value if it is a lowercase, upercase or special character.
- If the char is a lowercase or uppercase letter, it will calculate the correct shifted letter and store it in the same position to the encrypted text string.
- If the char is a special char, it will be copied to the same position on the encrypted text string.
- For each character in the string, the program will determine by using it's ASCII value if it is a lowercase, upercase or special character.
- When the scan is over, it will print the stored plaintext and it's encrypted variation for the user.