Projects Inventory

Encryption/Decryption Algorithm Gaming Project in C++

Explanation:

  1. Caesar Cipher Encryption (encrypt):
    • The encrypt function shifts each letter in the input message by a specified number of positions in the alphabet.
    • Advertisement
    • It loops through each character in the message:
      • If the character is a letter, it calculates its new position by shifting it and wraps around the end of the alphabet using modulo arithmetic.
      • Advertisement
      • The character is then updated with the new shifted value.
    • Non-alphabetic characters remain unchanged.
  2. Caesar Cipher Decryption (decrypt):
    • The decrypt function reverses the encryption by shifting in the opposite direction.
    • It uses the same encrypt function but shifts by 26 - shift to undo the encryption.
  3. Main Function (main):
    • Prompts the user to enter a message and a shift value.
    • Encrypts the message using the provided shift value.
    • Prints the encrypted message.
    • Decrypts the encrypted message using the same shift value and prints the decrypted message.
    • Advertisement

Possible Enhancements:

 

Exit mobile version