3 votes

How to Encrypt Plaintext Properly When it Contains Non-Alphabetical Chars?

As others have said, you can reduce your loops by combining what they do into one loop. You don't need to store the user input, so you can modify it without worry. Other than that, I would just add ...
user avatar
  • 182
1 vote
Accepted

My cipher algo is wiping out my keyword!

Buff! This is a hidden problem related to the preprocessing of the key. First of all, saying that trying to change a variable of type char * is not a good idea, however we can do this in vigenere ...
user avatar
  • 5,172
1 vote

PSET2: Can't figure out what's wrong with my crack.c code?

The problem is that you have essentially created an infinite loop. Initially when your while code starts, your first for loop runs, then your second, then third and then fourth but they never check ...
user avatar
1 vote
Accepted

CS50 pset2 Caesar's cipher - Compile but doesn't work?!? GetString() above and beyond

In testing your code, it appears to ask for the string correctly. However, if there is a non-alpha in the string, it will go into an infinite loop in the while loop because the only time you ...
user avatar
  • 63.2k
1 vote
Accepted

Why Doesn't Vigenere Give the Correct Output?

Your check if(j >= length_k ) { j= j%length_k; } Just move this check to right after j++. like this j++; if(j >= length_k ) { j= j%length_k; } That should solve your problem.
user avatar
  • 150

Only top scored, non community-wiki answers of a minimum length are eligible