Encrypt and decrypt a text

How can i do this program... i have tried many codes but it does not work any ideas?
I need help

Write a program that implements the Caesar cipher. The Caesar cipher shifts each character in some plain text by some key value. All uppercase and lowercase characters will be encrypted. Everything else (numbers, punctuation, spaces, etc.) will not be encrypted (but still output to the terminal).

Recommend you use the ASCII character codes for this (A-Z are numbers 65-90, a-z are numbers 97-122)...

Here's a hint.... characters passed to integers return the ASCII value...
1
2
3
4
int x;
char y = 'K';
x = y;
// x will equal 75 

So...

Pseudo code would look something like....

1. Read data chunk from a file or user input (unencrypted)
2. Check to see if it's letters A thru Z or a thru z
2a. If true, shift the ASCII value + KEY_VALUE
2b. If false, don't change anything
3. Put data in file #2 or display as output (encrypted)
4. Loop back to 1
Last edited on
Topic archived. No new replies allowed.