0

Alright, so I'm working on vigenere and I have two main problems. When the key is longer than the input, the output content is correct, except it is all uppercase (note that I have code to make it lowercase, but it doesn't seem to execute). And when the key is shorter than the input, I get non-alpha characters. Here is my code: https://www.dropbox.com/s/mndxhcbrtdwlo69/vigenere.c?dl=0

For example: input and output:

pythonhax@PYTHONHAX-MINTKDE:~/Dropbox/CS50x/pset2 > ./vigenere pythonhax
foobar    
UMHIOE
pythonhax@PYTHONHAX-MINTKDE:~/Dropbox/CS50x/pset2 > ./vigenere pythonhax
foobarbazquux
UMHIOEIAW.JKO

This is running on my personal Mint 17.1 KDE partition and not the appliance.

1
  • Any help please?
    – pythonhax
    Jan 20 '15 at 16:32
0

Regarding your first problem, your cipher and text variables share the same location in memory because you're passing a pointer when you call your encipher function. This means your islower() check in line 70 will never return true.

Also please comment your code when you want others to read it. It's pretty tough to know what's going on without going through every detail.

1
  • Thanks. I solved this yesterday before you commented, but thanks for your help.
    – pythonhax
    Jan 22 '15 at 22:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .