Hail Caesar!

So I figured out how to make a Caesar Cypher work! It hit me this morning.

First, I dont need a second array. Or an array at all for that matter (unless you count argv). Once I wrapped my mind around how you can add an int to a char and change the actual char it was simply a matter of iterating over each char, moving it by its shift, and then printing it one by one. I had to throw in a set of conditionals to discern between upper and lower case letters but other than that its pretty simple. As per the instruction of the problem set I had to leave the non letter chars alone. 

I’ve uploaded it to my dropbox. Take a look here: 


I’d gladly take any ideas on how to better manage those conditions. They look a little ugly to me. I feel like an an artist who has yet to learn how to draw more than stick figures. Meh, it’ll come with time. 

Now I need to figure out how to implement a shift word instead of a mere number. Yeessss.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s