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
3
votes
1answer
446 views

Pset2 - Readability: How to round a .5 number depending on the 2nd digit after the decimal point

I have written a solution for readability from pset2 but I'm having problems with one of the points: :( handles single sentence with multiple words expected "Grade 7\n", not "Grade 8\n". So I ...
0
votes
1answer
45 views

CS50 PST2 Directory Naming

I am working on readability from problem set 2 and one of the guidelines is to program on a file called readability.c on the directory called readability and while I named the file corectly I cant ...
0
votes
1answer
2k views

Get help in Pset2 Substitution

The Errors- :) substitution.c exists :) substitution.c compiles :( encrypts "A" as "Z" using ZYXWVUTSRQPONMLKJIHGFEDCBA as key output not valid ASCII text :...
0
votes
1answer
160 views

PSET 2 Caesar - Errors when key is a large number

// Converts Plain Text to Cipher Text int key; int prompt(void); int enicpher(void); // Takes User Command Line Arguments as Key if criteria are met int main(int argc, string argv[]) { // Throws ...
0
votes
1answer
1k views

Counting words pset2 Readability

there. I am trying to complete pset2 Readability and have a doubt on counting words. Can this be an approach? int words = 0; for (int i = 0; i< n; i++) { if (isblank(text[i])) { ...
0
votes
1answer
97 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
1answer
59 views

cs50 pset2: check50 does not accept output

I am running check50 but it will not accept my output as correct. For example, one of the conditions needed to be satisfied is: When I run the code below I obtain the desired output (CAQGON) but ...
0
votes
0answers
16 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
323 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 ...
0
votes
1answer
159 views

PSet2 doesn't match with Gradebook

I started the course on the 7th of January of 2020. I've done PSet0 and PSet1 with no problem. Now I'm in the middle of PSet2. I've done Caesar and submitted it. It appears in my Gradebook. Now I've ...
0
votes
1answer
71 views

isdigit and isalpha only checks first character - pset2

I had my Caesar all set and was moving on to Vig when I did one more check and realized that isdigit was only checking the first character. "[blank]", "aaa", "3 3" would all get kicked back and "44" ...
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
606 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) { ...
3
votes
4answers
2k views

Pset2 Readabilty: Why are my grade levels calculating incorrectly?

For Pset2: Readability, I'm writing a program in C that prompts the user for text input, analyzes how many letters, words, and sentences are in the text entered by the user, and calculates the grade ...
0
votes
2answers
170 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
28 views

pset2 Vigenere Looping Help

I'm sure I'm doing something dumb, but after spending hours searching the topic, I can't figure it out. Instead of pairing the 1st char in the keyword to the 1st char in the plaintext, the 2nd char ...
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
20 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
25 views

cs50 caesar help

Hi everyone I'm having trouble with my code, it compiles just fine but when I go to do the plaintext to ciphertext it only shows 1-2 letters at a time instead of the whole word. Idk where could the ...
0
votes
1answer
151 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
2answers
83 views

Caesar - unexpected results - weird character added to cypher

My code seems to be working but when I enter only one or few characters in my plaintext, my cyphertext returns weird characters... I had a look at my code and try couple of solutions and I can see ...
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
1answer
29 views

pset2: "vigenere" missing output

when i use isString function or any function which containing "isalpha" function. My code provide missing output. When i remove isString function it works well. But i don't understand ...
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
27 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
53 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
223 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
75 views

I can't get my Vigenere code to skip spaces and punctuation, I don't know why

#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int shift(char c); int main(int argc, string argv[]) { // Checks to make sure user enters ...
0
votes
1answer
29 views

I can't work out what is wrong with my code - I think I am not indexing into the key

#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int shift(char c); int main(int argc, string argv[]) { // Checks to make sure user enters ...
0
votes
1answer
2k views

I keep getting an error: incompatible pointer types passing 'string' (aka 'char *') to parameter of type 'string *' (aka 'char **')

#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int shift(string argv[]); int main(int argc, string argv[]) { // Checks to make sure user ...
0
votes
1answer
41 views

Error message: 21:9: error: expected expression else

I keep getting the above error: #include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int main (int argc, string argv[]) { if (argc != 2) { ...
0
votes
2answers
995 views

Caesar - Validating key using isdigit

I keep getting this error: caesar.c:17:13: error: subscript of pointer to function type 'int (int)' if (isdigit[i] == 0) This is my code: #include <cs50.h> #include <ctype.h> #...
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
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
0
votes
1answer
108 views

My solution to Pset2's Caesar works but I only got 40% on it. Why?

I worked my way through Caesar as well as Vignere in PSet2. I got a score of 99% for Vignere but only 40% on Caesar, which is really strange as I worked off of Caesar for Vigenere.. If anyone could ...
0
votes
1answer
245 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
236 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
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
0answers
90 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
861 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
89 views

Validation bug on caesar, repeating loop error for more than one digit key

After spending many hours on caesar, I have restarted from nothing several times and think my program is able to correctly validated the key given by the user. The problem is that my validation only ...
0
votes
2answers
65 views

pset 2 need help validating key on argc argv

how to defend against argv[1] with alphabet input? I can defend against: ./caesar 1 2 3 and ./caesar -123 BUT NOT ./caesar abcd AND ./caesar 12ab My code is as follow: int main(int argc, ...

1
3 4
5
6 7
26