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(...
MrBobJamesBob's user avatar
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 ...
Cliff B's user avatar
  • 68.4k
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.
DinoCoderSaurus's user avatar
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 ...
Tritum's user avatar
  • 1,571
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 ...
Blauelf's user avatar
  • 20.9k
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 ...
curiouskiwi's user avatar
  • 18.6k
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 ...
Cliff B's user avatar
  • 68.4k

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