Questions tagged [pset2]

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

231 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
294 views

pset2 readability. im getting 8 instead of 7th gread

Anyone knows why i get this error? :) readability.c exists :) readability.c compiles :( handles single sentence with multiple words expected "Grade 7\n", not "Grade 8\n" :) handles punctuation ...
0
votes
1answer
22 views

What do I do if I get "too few arguments to function call"?

What do I do if I get "too few arguments to function call"? Here is my code: #include <cs50.h> #include <math.h> #include <stdio.h> int main(void) { // Declare and ...
0
votes
1answer
78 views

I got my code to work but it doesnot meet the requirements

:( handles non-numeric key timed out while waiting for program to exit the program: #include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <ctype.h> #include &...
0
votes
1answer
132 views

Cs50, cipher text not printing

When i run my code, everything seems to be fine apart from the printing of the ciphertext, and the code doesnt seem to be getting passed the for loop of the string length of plain. Any ideas? #...
0
votes
0answers
19 views

I was doing problem set 2 for CS50x 2020 and I wanted to know why this is wrong

include int main(void) { k = get_int("Enter a number: ") char str[20]; printf("Enter message"); gets(c); for (i = 0; i < strlen(str); i ++) { if (islower(str[i]) {...
0
votes
1answer
65 views

PSet 2 -- Substitution set:

All the check50 inputs are working fine, apart from the one where the input is "The quick brown fox jumps over the lazy dog". In this case my code works fine till 'jumps' and after that the code doesn'...
0
votes
2answers
84 views

Counting apostrophe

How do I count the character apostrophe ( ' ) in a sentence. When I tried: if (s[n] == (''') error message showed "expected expression". missing terminating ' character. Other characters counting ...
0
votes
0answers
82 views

PSET Make Readability

i am having some problems trying to execute make readability. Can you help me? Thanks in advance!
0
votes
1answer
193 views

Having issues creating readability and readability.c directory and file

I am a beginner and have zero knowledge of coding. Right now, I am working on problem set 2, but something is wrong and cant properly create readability.c and readability. This is what I am doing: ...
0
votes
1answer
718 views

problem set 2 caesar check :( handles non-numeric key timed out while waiting for program to exit

I have gotten my code to work for the caesar problem in problem set 2. However, when i check through check50 I run into this error: :( handles non-numeric key timed out while waiting for program ...
0
votes
1answer
44 views

PSET 2 IDE Compiling Issues

I am now on PSET 2 and moved to the CS50 IDE, however, when trying to set up and test the IDE by writing and compiling a simple piece of code under the title readability, i get the below error. I ...
0
votes
1answer
93 views

Why doesn't my Caesar code not return an output for the cipher text?

Can anyone help me out why my code won't return any cipher text, think it has something to do with the formula ci = (pi + k) % 26 I have done. Any help much appreciated. // Libraries #include <...
0
votes
0answers
1k views

PSET2 Caesar : problem regarding non-numeric key

my code for Caesar works fine regarding the ciphering part but it won't pass the check50 because of the criteria "handles non-numeric key" and I have this message : "timed out while waiting for ...
0
votes
0answers
49 views

pset2 caesar expected expression error

I can't understand this error. caesar.c:22:20: error: expected expression string p = get_string(); ^ /usr/include/cs50.h:109:53: note: expanded from macro 'get_string' ...
0
votes
1answer
57 views

no rule to make target pset2

I am currently working on the readability problem in pst2. I followed the 'getting started' instructions to create and open the file in the readability directory, however, I am still getting a "make: *...
0
votes
1answer
2k views

Pset 2 - Substitution

I hope you are all well. Just had a quick question about CS50 Pset2's substituion problem. Please see my code below. #include <stdio.h> #include <cs50.h> #include <string.h> #...
0
votes
1answer
203 views

Caesar pset2 - using isdigit(argv[1][i]) only looks at the first character

I have read through the other posts where you need to use argv[1][i] when using isdigit to avoid the error. It does eliminate the error, but it is only reading the first character and stops. I can ...
0
votes
0answers
90 views

segmentation error in caesar, I am unable to understand why

Here is my code: #include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main(int argc, string argv[]...
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
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
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
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
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
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
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
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
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, ...
0
votes
1answer
160 views

Validating the key in PSET2 caesar?

int main( int argc, string argv[]) { if(argc ==2) { for(int i = 0, n = strlen(argv[i]); i < n; i++) { if(isdigit(argv[1][i])) { ...
0
votes
3answers
672 views

Pset 2 - String is unitialized, initialize the variable to silence this warning

I am working on Caesar cipher on CS50 Week 2. I have generally wrote most part of the code but the final error message which i have not debugged was the initalizing of the string at the end. How do ...
0
votes
1answer
86 views

Vigenere/ PSET 2/ It works for me but it can't pass the check50

Im trying to figure out where my problem is. Usind the examples given with the keys the transcription works fine. But if i try to run check50: //Checking for right argument if (argc != 2) { ...
0
votes
1answer
52 views

pset2 - crack - array declaration not working

I feel stupid, why is not printing "ROFL" in this program? I am testing for the crack.c program: #include <stdio.h> #include <cs50.h> //int main (int argc, string argv[]) int main (int ...
0
votes
1answer
448 views

Pset2 (Caesar). Runtime error: load of null pointer of type 'char'

Problem with segmentation. I can compile the program, but can't run. Questions about segmentation fault were asked many times, but I still don't know. I think problem with command-line argument — I ...
0
votes
1answer
111 views

PSET 2 ----CAESAR

I am struggling in Caesar in Pset2. I am not being able to understand what is the function of argc and from where will the code pickup alphabets? That is, how will the software understand that "b" ...
0
votes
1answer
55 views

My pset2 caesar program keeps giving an output of 0, how to get to the ciphertext?

I came up with these lines of code to get from a character in the plaintext to a new character in the ciphertext. I keep getting an ouput of 0 everytime I run it, no matter which key I choose or which ...
0
votes
0answers
53 views

Expected identifier or '(' and undeclared identifier ERROR (PSET2 Vignere)

Hi all, I'm getting 6 errors from my code, stemming from two main reasons: Expected identifier or '(' Use of undeclared identifier I can't figure out what went wrong my code even after inspecting ...
0
votes
1answer
84 views

pset2 - caeser help

It seems I am getting the correct answers when caesar is run, but I am failing all of my check50 tests. Please help??? #include <stdio.h> #include <cs50.h> #include <...
0
votes
2answers
567 views

Style50 says "Looks good!" but "style" grade only 4 out of 5?

For pset2 - crack, I've run style50 and got a "Looks good!" but upon submitting, my style grade is marked as 4 out of 5. I see this question has been asked in the past and the solution usually was "...
0
votes
1answer
446 views

String being replaced by garbage before being printed

I have this code: #include <cs50.h> #include <stdio.h> #include <string.h> string increment_str(); int main() { string s = increment_str("xyz"); printf("String: %s\n", s); }...
0
votes
1answer
66 views

Vigenere Pset2 ciphertext question + others

(Main question- need help on this for code to work! highlighted in screenshot.) My PSET2 code works fine up until asking the user to input plaintext, but becomes funky and outputs blank spaces as the ...
0
votes
1answer
137 views

Segmentation Fault while Debug50 returns an output

I've been struggling with Vigenere for a while now, and now that I "believe" I got to the point, I get a segmentation fault error when I run the program. Weird thing is that while I try to spot the ...
0
votes
0answers
611 views

please help, cant seem to see where i went wrong here with fahrenheit.c from old friends. supposed to get input from command line

#include <cs50.h> #include <stdio.h> #include <stdlib.h> int main(int argc, string argv[]) { if (argc != 2) { printf("Usage: ./fahrenheit <celsius temp>\n"); ...
0
votes
1answer
109 views

MARIO!! just look over

what in the world is wrong with my code: #include <stdio.h> #include <cs50.h> int main(void) { int n; do { // prompt user for a number 0 to 23 n = get_int(); printf ...
0
votes
2answers
76 views

Still struggling with vigenere

I have been futzing with this for a couple of weeks. I actually put it away while I did pset3 but, having come back to it, I'm still stuck. I spent an entire day on it this weekend and tried adding a ...
0
votes
1answer
57 views

caesar program not printing plain text

I have made my caesar program, and when compiled it doesn't generate any errors. However, once I run the program with a valid command argument, and then input text, nothing is printed after. Here is ...
0
votes
0answers
223 views

Stuck in infinite loop in CRACK - Pset2

This is day 2 of being stuck on the problem, with over 12 hours spent on this problem. I can't seem to find the issue with my code (except that it has a runtime complexity of O(n^6) ). I know this is ...