Questions tagged [pset2]

The problem set for Week 2 continues with the C programming language used in problem set 1.

Filter by
Sorted by
Tagged with
0
votes
1answer
98 views

PS2 Caesar Algorithm

#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main (int argc, string argv[]) { //Terminates if Command-line ...
0
votes
0answers
17 views

How can I stop the loop through the keyword when there is a nonalpha character in Vignere?

The code doesn't encrypt the nonalpha characters, so that is good, but it continues the count through the keyword rather than pausing it. So I encounter this problem: Expected: ./vigenere baz ...
0
votes
1answer
325 views

pset2 - Readability: Math not working properly

For the large sentence test of pset2's Readability task, I was constantly getting Grade 8 instead of Grade 7, even after checking the counting went properly. After roughly an hour of debugging I've ...
-1
votes
1answer
43 views

Help with pset 2 initials

My code only returns the first capital letter. Can anyone help?
0
votes
1answer
651 views

Inaccuracy in Readability Test Case

I have been testing my code with check 50 and one of the test cases - is calculated as Grade 9 in my program vs Grade 8. https://submit.cs50.io/check50/1bffffe43d39fcfdc8d7a8885bbf59b47b718918 Test ...
0
votes
1answer
607 views

Failure in Readability code

I'm having an issue with my code for pset2, Readability. My code so far is: #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(void) { ...
0
votes
2answers
173 views

Please help me, validating the key in this Caesar problem

#include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { if (argc == 2 && isdigit(*argv[1])) { for (...
0
votes
1answer
22 views

pset 2 vigenere help!

I'm having issues on how to start the shift value part of this assignment. I've gotten the first part of the assignment and making sure the argc is indeed a word or letter and not an integer. Could ...
0
votes
1answer
28 views

Pset 2 Vigenere - Shift value

I am at the point in pset2 Vinegere, where I have to write the shift function. The tutorial (or guidance on the left side in sandbox) is telling me to place the following line of code after the curled ...
0
votes
1answer
154 views

Caesar - Validating they Key

Hope you are doing well, a version of my question has already been asked and I went through some of those responses but it hasn’t helped so far. I am new to coding and working on the Caesar problem ...
0
votes
1answer
52 views

PSet2 Crack: crypt() returning same hash

EDIT: I solved my problem by entirely re-writing my code. I still am not sure what went wrong. I've been trying to go at the crack problem for a while now and it keeps returning the same hash. For ...
0
votes
1answer
71 views

Pset2 caesar: Issue with check50

The output is right, but check50 says that it is wrong]1 [removed code per academic honesty guidelines]
0
votes
1answer
26 views

Unexpected ciphertext. When I use plaintext like meet at the park at pm. All characters are shifted

//Program to encrypt the message by using vigenere's cipher #include <cs50.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int shift(...
0
votes
1answer
36 views

Need help understanding Pset2 Vigenere and how to increment keyword only on alphas

I've gotten stuck on Vigenere trying to shift the keyword only on letters. I've tried several different tactics; a for loop around the letters ending before the not letters, ifs, placing them in ...
0
votes
1answer
56 views

Unaccepted output with caesar

I am not getting the desired output when I want cipher the plaintext with key 13 with long sentence with commas and space. Please help, thank you. //Program to encrypt the message by using Caesar'...
0
votes
0answers
110 views

Submit50 & Check50 not submitting most upto date version of pset

I've been attempting to submit my Caesar cipher solution to no avail; my first submit worked fine but then I noticed that my code was well full of bugs. So, I fixed it, and submitted again. Following ...
0
votes
1answer
68 views

What's wrong with my code here?

it's not printing what i expecting when i write (b) as key and (m) as plaintext for checking it prints (n) but more than expected and i don't know what i'm missing any help would be appreciated, here'...
0
votes
1answer
28 views

I have multiple issues with my code

after rewriting my code again i faced some proplems, when i compile it with 'a' or other key it's not printing anything, and i'm checking if user not providing plaintext it should print messege but it ...
0
votes
1answer
54 views

what's wrong here? i get an segmentation fault error and am i at the right direction?

int keyvalue = 0; int n = strlen(argv[1]); char cipher; for (int i = 0; i < n; i++) { keyvalue++; } for (int i = 0, s = strlen(...
0
votes
1answer
158 views

when i run ./caesar it give me strange error i don't understand

caesar.c:9:20: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/include/stdlib.h:105:33: note: nonnull attribute specified here UndefinedBehaviorSanitizer:...
0
votes
1answer
224 views

pset 2 CS50 2019 Vigenere

I tried checking other Vigenere solutions, but I seem to find no way to solve the problem on the loop with text[u] and argue[1][i], I just can't make after the last ith valeu to go back to 0 ith valeu?...
0
votes
1answer
249 views

PSet 2: How do I ensure that the entire string is checked before printing a statement

In this problem set, we are supposed to obtain one argument (which comprises of digits), failing which, the user is prompted with a message, Usage: ./caesar key. I have attached the problem statement ...
0
votes
1answer
23 views

Pset2 Vigenere some flaws in the code

I somehow managed to come up with this code to vigenere but it gives me 9/11 with check50. It encrypts it badly when using the keyword BaZ and BAZ. Why is that please? And also I think I was supposed ...
0
votes
2answers
142 views

When a key of 0 is used in my caeser cipher, my if statement returns a 1

In my program I used a if statement to check if key = atoi(argv[1]) == 0, and if key is == 0, then my program returns a 1. However, it wasn't until I tested my program for corner cases that I realised ...
0
votes
1answer
3k views

Pset2 Vigenere: Control reaches end of non-void function

I´m trying to solve this pset but I got stuck with function declaration. I did everything according to the tutorial but the clang keeps showing an error: "control reaches end of non-void function" on ...
0
votes
1answer
46 views

I get 5/11 on check50 after submitting vigenere, even though my actual output and expected output are the same. Can someone please help me?

Here is my code [removed code per academic honesty guidelines] And here is the link to the check50 if it can be helpful https://submit.cs50.io/check50/b2fae7703d9488a6c2737ebd8aa7319b95daefbb
1
vote
0answers
62 views

CS50, pset2, crack, suggested dictionary file

I am taking cs50 on edx and I am currently on pset2, crack. I want to find a dictionary file that has a fair (maybe over 50,000?) amount of words in it to encrypt and compare them with the hashed ...
1
vote
1answer
132 views

Help with understanding the wrap-around method for Vigenere Pset

I'm having troubles with implementing the wrap around method needed for passing this problem. As you will see, my code so far encypher a number of plaintext letters as equal as the number of the "key" ...
0
votes
1answer
239 views

PSet 2: Code successfully compiled but does not meet desirec requirement

In this problem set, we are supposed to obtain one argument ( which omprises of digits), failing which, the user are prompted with a message, "Usage: ./caesar key". I have attached the problem ...
0
votes
1answer
91 views

CS50 Problem Set 2 Code Not Fully Executing

I am trying to get the code to check that: 1) Only a numerical argument is passed through 2) If a non-numerical, number is pass through, an error message is revealed to the user. Here are the ...
1
vote
0answers
91 views

PSET 2 - Crack - A way to improve?

To give a bit of context I am taking CS50 through EdX in 2019. I worked on pset2 (crack) the last few days. I got it "right" though I wonder if there are some ways to improve (1) the efficiency and (...
0
votes
1answer
901 views

UndefinedBehaviorSanitizer:DEADLYSIGNAL ERROR The signal is caused by a WRITE memory access

My goal is to figure out how to append to a new string. Why does top code work but bottom code gives error? Aren't they the same? Try it out. #include <cs50.h> #include <string.h> #...
0
votes
1answer
52 views

What does argc and argv have to do with cryptography? Why are we learning about these arguments?

I understand what these arguments do--take inputs before the program starts to in some way influence the program. But they seem to have been shoe-horned into the lecture. David moves on from this ...
0
votes
1answer
125 views

PS2 Caesar having trouble validating key

So far I've only gotten to the part where the code should check to see if the key is only digits. #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> ...
0
votes
2answers
58 views

Week 2 CRACK: Erratic behavior with NULL '\0' when printing combinations of letters

I want to iterate through all possible combinations of the alphabet, including single letter outputs. For this purpose I included the use of '\0' so the first print out in the iteration is the sigle ...
0
votes
2answers
81 views

PSET2 Vigenere: Output bug, keyword loop going over strlen of key

I am having an issue specifically with the second for loop (under "//iterate over key inputs" comment). The counter j is going over the strlen of argv[1], and thus feeding a wrong input to my shift ...
0
votes
1answer
89 views

Help with weird bug in pset2 vigenere

After finishing most of the program, for some reason when check50 attempts to encrypt BaRFoo using keyword BaZ as well as the other attempts for the variations of barfoo and "hello, world", my code ...
0
votes
2answers
50 views

Crack.c Error in 2 passwords

For pset2 crack, I have managed to crack 10 of the 12 passwords given, but, the other 2 passwords are not getting cracked. Any help would be appreciated. Code: //Cracks password encrypted using ...
1
vote
2answers
58 views

PSET 2 Vigenere - only getting symbols as output

So far in Vigenere i've gotten to the point with a single character key, and when I tried to test it, everything works except my output is entirely ����. Here is my code for the shift function and ...
0
votes
2answers
535 views

pset2 (Hail, Caesar) - How to refine my code

i'm new to this and CS50. int main(int argc, string argv[]) { if (argc <= 1 || argc > 2) { printf("Open program with a key!!!\n"); return 1; } int k = atoi(argv[1]); ...
0
votes
1answer
140 views

PSET 2 Crack: Getting salt from argv[1]

I think I might be misunderstanding some basic things about strings because I'm really struggling to get the salt in crack. I'm getting compile errors from the below code. I've also tried making the ...
0
votes
1answer
87 views

Problem with Pset2 submission vigenere

I just wrote the program for cs50 pset2 vigenere problem. It ran perfectly when I tried to run it, with expected output. But on submitting, cs50.me check50 shows that my program does not show the ...
1
vote
2answers
221 views

Initials runs, but no output

I run this program in my terminal and it compiles right, but I don't quite understand why, when I type something, no output is printed and the blinking prompt with the home directory shows up again. I ...
2
votes
2answers
235 views

PSET2, crack.c Did this problem fall out of the sky from week 115? Am I overthinking this?

This is the spec: Specification Design and implement a program, crack, that cracks passwords. Implement your program in a file called crack.c in a directory called crack. Your ...
0
votes
1answer
347 views

How do I validate a key in Caesar?

I'm having difficulties in validation step in Caesar. My logic here is to pass through each digit and check if it is a number character and if not, abort. If they all are, it will convert each ...
0
votes
1answer
527 views

pset2 caesar.c (need help,Thank)

check50 :( encrypts "world, say hello!" as "iadxp, emk tqxxa!" using 12 as key \ expected output, but not "ciphertext: iadxpemktqxxa\n" #include <cs50.h> #include <stdio.h> #include &...
0
votes
1answer
219 views

pset2: vigenere.. Getting same output as the staff's solution, but still gets the score 2 out of 5.. Could some one guide me to the problem?

#include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int shift(char c); int main(int argc, string argv[]) { // Check that ...
0
votes
1answer
98 views

pset 2 caesar help!

am having trouble printing the correct ciphertext, code is rather lengthy for sure but will appreciate it a lot if anyone can tell me what's the problem here! For example with a key of 1 and a ...
0
votes
1answer
76 views

Pset2 - Shifting characters in String but not getting the correct answered

i am attempting Vigenere on CS50 Pset2. I am creating a new array with same length as keyword to shift to its digit counterpart. However i am not getting the correct answer, any idea what is the ...
0
votes
1answer
26 views

PSet2 why isn't this providing output

This segment of code only prints out blank lines. Key is the correct integer, but I must be handling the array of characters incorrectly. Thoughts? int key = atoi(argv[1]); for (int i = 0, c = ...

1
6 7
8
9 10
26