2
votes
Accepted
Pset2 Caesar: extra letter printed at the end of ciphertext
Currently it looks like you're looping through your ciphertext from 0 up to strlen(plaintext), however, you assigned ciphertext the size of strlen(plaintext)+1.
Here's what's happening: The GetString(...
2
votes
Accepted
I'm stuck at PSet 2 Caesar Cipher: The alphabets don't follow my modulo 26. It goes beyond it, printing non-alphabetic characters
The problem lies here:
int asciiValue = plaintext[i]+key%26;
Simply put, it won't work at all. plaintext[i] contains an ASCII value for a letter. That's a number somewhere between 65 and 122 ...
1
vote
Accepted
How to solve "error: expected expression" while doing Caesar.c
This doc shows the correct syntax for the typecast operator in C.
Syntax
( type-name ) expression
Typecasting is demonstrated in the lecture at around 1:03:00.
1
vote
Accepted
Caesar - Problem set 2 - incorrect output
As you know you've created a for loop that iterates once for each character introduced by the user of your program so, if you don't want to print printf("ciphertext: ......." for every character, you ...
1
vote
Accepted
pset2//caesar- relational operator result unused error
First to the error: i<len,k>=0 uses the comma operator, which evaluates its left side, discards the result, and evaluates to its right side. So i<len,k>=0 is the same as k>=0, the value ...
1
vote
Accepted
pset2 caesar please help
cipher = (chr+key) % 26
So, if you enter, say d and a key of 5, then:
cipher = ('d' + 5) % 26
cipher = (100 + 5) % 26
cipher = 1
1 is a non printable char.
The formula for caesar given in the pset ...
1
vote
Accepted
pset2 caesar alphabet loop
Simply put, your formula is flawed. Look at the formula that you have:
code = code + user_key % 26;
Assuming that you haven't altered the formula in your conversion to pseudocode, it has two ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
cipher-pset2 × 21pset2 × 16
caesar × 6
pset2-caesar × 6
vigenere × 3
cs50x × 2
pset × 2
vigenere.c × 2
caesar-cipher × 2
cs50-pset2 × 2
cs50-vigenere × 2
bash × 1
encryption × 1
expected-expression × 1
problemset2 × 1