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(...
user avatar
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.
user avatar
1 vote
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 ...
user avatar
  • 64.1k
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 ...
user avatar
  • 1,561
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 ...
user avatar
  • 20.7k
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 ...
user avatar
  • 18.4k
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 ...
user avatar
  • 64.1k
1 vote
Accepted

Vigenere code still rotates for nonalpha

You're on the right track that something is wrong with J. The problem is that you've tied the index for the key, j, to the index for text, i. int j = i % strlen(keyword); You are probably seeing the ...
user avatar
  • 64.1k

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