I pasted the code here: http://codepaste.net/hy5n6m .

In that version creating a cypher is no problem but decrypting a code doesn't work. I've only gotten it to work a couple times and I lost those versions (because something else always went wrong there).

I have a couple other versions which don't work either but that's the most recent one. Another one reversed the letters in the wrong order and another one never reversed the first letter. Can anyone point me in the right direction? I've spent over 6 hours on this assignment which was supposed to be really simple.

Also, I don't want anyone to solve it for me since this is for an assignment for school. Just pointing me in the right direction. I have no idea what's going on. Thank you.

What's wrong with the following if statements?

if(enorde=1)
    {
        do
        {


    if(enorde=2)
     {
        do
        {

Your code appears to be converting the letters to upper case and then doing the shift. Then in your decode function, you're again checking for upper case and if upper case you're AGAIN SUBTRACTING 32. What's wrong with this picture?

Finally, avoid using magic numbers such as 97 and 122. Instead use defines to provide a clear understanding of the meaning of these numbers. In other words, define 97 as upper case A etc.

The enorde is checking whether people want to encrypt or decrypt. I thought it'd work since it wouldn't do the enorde=1 loop if enorde was 2. I sitll don't quite get it..

I thought it'd work since it wouldn't do the enorde=1 loop if enorde was 2. I sitll don't quite get it..

This link should help you understand the error of you ways.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.