Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 11300

Vigenere Cipher, one of the assignments in Problem Set 2. It's like Caesar Cipher, but with a twist.

1 vote

CS50 Week 2 Vigenere Problems

return ((c-97) & 26) I think you don't want to use the operator '&', but the modulus operator '%', the first one is a bit-level operator. They affect the operands bit by bit, so the logical operatio …
MARS's user avatar
  • 5,179
1 vote
Accepted

pset2 Vigenere null pointer passed as argument 1, which is declared to never be null

Five functions for Vigenere seem excessive to me. Well, everything is a matter of preferences. …
MARS's user avatar
  • 5,179
0 votes
Accepted

How do you make a variable work in multiple loops?

In order to use a variable in any loop or function, we must declare it outside any of them. If your program does not use auxiliary files, it is sufficient to declare it inside main and outside any cod …
MARS's user avatar
  • 5,179
1 vote
Accepted

My cipher algo is wiping out my keyword!

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 because the function get_string () is using the dynamic allocation of memory …
MARS's user avatar
  • 5,179
1 vote
Accepted

check50 pset2 vigenere problem

A really strange problem, everything is the fault of the following statement: int j; We have not initialized the variable j, after using gdb j it is set to zero inside the following statement: j = …
MARS's user avatar
  • 5,179
0 votes

Still being stuck in Vigenere

In vigenere change the letter with each letter of the text in clear, when we reach the final character of the keyword we start again with the first character, this suggests the use of the module with the … /vigenere <key>.\n"); return 1; } We have isolated a block of code that does a task, and it ends there when the check is done, we do not worry about it anymore. …
MARS's user avatar
  • 5,179
1 vote
Accepted

Vigenere:non-alphabetical character

i<= strlen(keyword) keep in mind that keyword begins with the zero subscript so that if its length is given by strlen the one index is strlen(keyword) - 1, the correct statement would be: i < strle …
MARS's user avatar
  • 5,179
0 votes
Accepted

Segmentation Fault Vigenere

The problem is in the string keyletter, I suppose that it is destined to store the uppercase version of key, however you do: string keyletter = 0; This is to make the pointer keyletter point to NUL …
MARS's user avatar
  • 5,179
1 vote
Accepted

segmentation fault error vigenere. help please

isalpha() do not accept a pointer but only characters, hence segfault. You must write isalpha(k[i]),the simplest thing is to use a for loop to iterate over each character, besides there are other erro …
MARS's user avatar
  • 5,179
1 vote
Accepted

Can someone show me how to use isalpha() in an if() condition?

Isalpha takes as an argument a character, it is easy to use a for loop to iterate over each character in a string: string name = "my name"; // char* name for( int k = 0, s = strlen (name); k < …
MARS's user avatar
  • 5,179
0 votes

On running as ./a.out <keyword>

isalpha(argv[1]) Is the responsible declaration of segfault, argv[1] is a pointer to a string, isalpha() has as its argument a character. If you do k = argv [1]; you can access each individual chara …
MARS's user avatar
  • 5,179
1 vote
Accepted

Pset2 Vigenere integer to pointer conversation

string Final = (((UI[i] - 'A') + tolower(key[a % keyl]) - 'a') % 26) + 'A'; It is an incorrect assignment: (((UI[i] - 'A') + tolower(key[a % keyl]) - 'a') % 26) + 'A'; The above line is an integ …
MARS's user avatar
  • 5,179
0 votes
Accepted

cs50/pset2/vigenere why can't my code handle a key world of Hax0r2? code works otherwise

isalnum() checks for an alphanumeric character, argv[1] is not a character but a string (exactly a pointer to string),the right way would iterate over the length of argv [i] to check each character in …
MARS's user avatar
  • 5,179
0 votes

PSET 2 problem!

else { printf ("%c", p[i]); } FOR loop will not consider whitespace, but if printed, anyway your formula is not correct, note that the formula for Vigenere is exactly the same as for Caesar, but …
MARS's user avatar
  • 5,179
0 votes

PSET 2 Vigenere - problem

if (isupper(letter[i])) ..... else if (islower(letter[i])) ..... you do not consider the formulas when if (isupper((key[i]))...
MARS's user avatar
  • 5,179

15 30 50 per page