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
51 views

Why do i get these errors? i am new to programming so please be easy on me. The errors are in the body

#include<stdio.h> #include<cs50.h> #include<string.h> #include<ctype.h> bool check_validity_key(string s); int main(int argc, string argv[]) { if (!check_validity_key(argv[...
0
votes
1answer
194 views

I have a segmentation fault in Caesar in pset 2

Okay, first time writing here and I am a complete noobie. The program compiles and I have run the debugger, and it seems that I have a segmentation fault which I have marked. Also, I have used a lot ...
0
votes
2answers
56 views

pset2 caesar - showing "output not valid ASCII text once"

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int cypher(string k, char p); int main(int argc, string argv[]) { if ...
0
votes
1answer
283 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
49 views

Copying an array (string) to new array after light mutating (pset2 readability)

I'm working on the readability task in pset2. I've made a new function which is going to count each letter in a string. What I want to do, is to get a user's input string, save it in a variable text ...
0
votes
1answer
75 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
123 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
75 views

Pset2 Functions video - Valid triangle solution

I tried to create a solution involing some of the new things learned in the weeks lecture such as arrays. How can I improve on this and why is my do loop to obtain a positive float value for the ...
0
votes
1answer
63 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
320 views

PS2 substitution

I am trying to check that the substitution key contains all the alphabets but am getting error: expression result unused for this line of code: s, l ++; Can anyone help, this is my code as of now: ...
0
votes
2answers
82 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
74 views

datatype string is malfunctioning in pset2 2020

I am currently working on pset2 cs50 2020. The Ceasar's cipher problem. I have managed the code for the first few steps and I think I know how to do the rest however I'm having an issue declaring ...
0
votes
2answers
65 views

pset2 readability. cannot compile although int is declared and code is complete. could someone please look into?

#include<cs50.h> #include<stdio.h> #include<string.h> #include<ctype.h> #include<math.h> int main (void) { string text=get_string("text:\n"); // to count ...
0
votes
0answers
30 views

Caesar (Pset2): When i print out ciphertext, some additional characters, that are not supposed to be part of the array, print out. How do i fix that? [duplicate]

// Receive plaintext string text = get_string("plaintext: "); int t = strlen(text); char ciphertext[t]; //Array assignment for (int i = 0; i < t; i++) { // Plaintext to Ciphertext ...
0
votes
1answer
141 views

help with PS 2 Readability

Need help! Newbie alert over here - Readability program compiles fine, and print a return message, but I can't figure out why i keep getting the wrong grade number. Seems letter, word and sentence ...
0
votes
1answer
18 views

problem set 2 Vigenere char problem

I just completed the vigenere problem set and I had this weird bug which, despite fixing it, don't understand why it was a bug. When I was implementing the caesar shift part, I added the plaintext ...
0
votes
1answer
192 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
709 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
43 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 ...
1
vote
1answer
33 views

Any advice on getting the CS50 IDE to read my closing parentheses, brackets and curly brackets

I've been trying to work on the Caesar problem in CS50 and keep running into the same problem of it not reading the second parentheses of my printf code. When I try to test it without the printf ...
0
votes
1answer
51 views

pset2 caesar function to read argv[1] not working

So I am still struggling to get my Caesar program to read argv1[1]. my program compiles and returns a value of "1" if the incorrect number of arguments are entered. The problem seems to be that it ...
0
votes
2answers
129 views

Why can't I do "string text = get_string();"?

Why can't I do printf("Text: "); string text = get_string(); in order to get a string, text, which contains what an user inputs? I saw Doug Lloyd do something similar in this video: https://www....
0
votes
1answer
80 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
1answer
81 views

Why is my (readability.c) file in ~/.c9/metadata/environment/readability/ instead of ~/readability?

I'm doing pset 2 and did the following in the CS50 IDE (copied directly from my terminal): ~/ $ cd ~/ $ mkdir readability ~/ $ cd readability ~/readability/ $ open readability.c and I couldn't find ...
0
votes
3answers
324 views

Pset2 "make readability" does not work

I have done all of the following instructions for Pset2 readability but am still unable to execute "make readability": "Execute cd to ensure that you’re in ~/ (i.e., your home directory)" "Execute ...
0
votes
1answer
17 views

Why does my code keep returning 1 with the error message even though I input a digit?

I am trying to complete the Caesar excercise on pset 2. My code compiles fine however it seems to give me me the output Usage: ./caesar key even though I input an int. Any help is much appreciated on ...
1
vote
1answer
392 views

pset 2-substitution-error handles multiple duplicate characters in key timed out while waiting for program to exit

Im working on substitution from pest 2 and I'm getting everything approved except for the last message: handles multiple duplicate characters in key timed out while waiting for program to exit Below ...
0
votes
0answers
48 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
520 views

How to get my code to print the right letter count?

I wrote some code to print out the required number of letters inputted into a given text. For some reason after 9 letters it seems to increment by one and will slightly overshoot the number of letters ...
2
votes
1answer
757 views

Pset 2 - Substitution - Error - handles multiple duplicate characters in key

I have finished the substitution pset2 problem, however, there was one error when I submitted my assignment. The description of this error was handles multiple duplicate characters in key. timed out ...
1
vote
1answer
399 views

PSET2 Substitution - Output seemingly correct, fails check50 (null character?)

thank you for your help in advance! I can't wrap my head around what's wrong with my code as the output is (seemingly) correct. I suspect it has something to do with the null character. #include <...
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
2answers
20 views

week 2 cs50 int.c not compiling

so want to know why this didn't work Screen shot below
0
votes
1answer
162 views

PSET2 Readability, most of my code works as expected, but one passage provided below

include include include include include int main(void) { // Ask user for input string s = get_string("Text:"); // variable to store letter, word, and sentence count int letterCount ...
0
votes
1answer
62 views

Pset 2 Caesar "Expected Expression" - If statement

For the Caesar pset, I am having trouble trying to fixing an expected expression error. for (int i = 0; i < int n = strlen(argv[1]); i++) { printf("test"); } The condition inside the for-...
0
votes
2answers
984 views

"Output not valid ASCII text" error with Substitution pset

i'm having these errors when i check my code. This is it: #include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int main(int argv, string argc[]) { ...
0
votes
1answer
197 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
1answer
377 views

CS50 Readability - Inconsistency in results

This is my 1st post here. I am taking CS50 and I am stuck trying to figure out why the results for this weeks problem set are delivering inconsistent results. My code is below. It passes most of the ...
0
votes
1answer
96 views

Problem with Pset2!

I'm really not sure why my code doesn't work for char's that are L, and when 20 is added to them on line 34. Appreciate the help for a beginning coder please:) int main(int argc, string argv[]) { //...
0
votes
1answer
134 views

pset2 Readability variables not updating

On pset2 Readability and for the life of me I can't figure out why my variables are not updating. Whenever I try to print the "letters", "words" and "sentences" variables to screen to debug, it seems ...
3
votes
1answer
435 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
156 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 ...

1 2 3
4
5
25