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
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 ...
0
votes
1answer
6 views

PSET2 Substitution: Trouble only in encrypts all alphabetic characters using DWUSXNPQKEGCZFJBTLYROHIAVM as key

so this is my code. All problems are compiled successfully except this one. The output is "Segmentation fault" this is my code: #include <stdio.h> #include <cs50.h> #include <...
0
votes
1answer
31 views

Comparing the hashed version of different string to the provided hash.

I am badly struck at the Crack problem in pset2. I have an idea which uses 5 for loops, to check for all the possible variations of the alphabets. Considering a case where the password is only of ...
0
votes
1answer
46 views

Vigenere problem output

Hi I hope somebody can help! my program works fine but only when it gets to the end of the keyword it passes one character and doesn't print. #include <stdio.h> #include <cs50.h> #include ...
0
votes
2answers
38 views

PSet2 / Substitution

I am trying to make an upper case key and a lower case key of the one typed by the user but when I use the toupper and tolower functions they turn all my chars into lower or upper. Not just the one I ...
0
votes
2answers
253 views

Pset2. Caesar. Can anybody help me please? What I am doing wrong?

Here is my code for caesar: #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { if (argc!=2) { ...
0
votes
1answer
45 views

pset2 caesar, I really dont know, its printing the first capital twice?

im stuck now, I cant see it. Its all working and ciphers correctly, but whenever the first index of plaintext is a capital, it seems to print it twice? I have gone through it line by line for ages ...
0
votes
1answer
51 views

Segmentation fault in initials.c pset2 cs50 2017

The following is my code for pset2 initials 2017 and I got a segmentation error. Can someone plse help me debug this. Now here's the output : Hello what's your name? ansh parashar ...
0
votes
1answer
19 views

Pset 2 (Substitution), time out (handling of incorrect chars)

The below code lost a mark; check50 gave the explanation just below. A different time-out query (by Abhijit) appears to have had a different cause. The check50 line used: check50 cs50/problems/2021/x/...
0
votes
1answer
412 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
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
49 views

unexpected output vigenere

I am getting an odd output and can't figure out why. I have tried using a debugger and tried different ways of approaching the problem. int main(int argc, string argv[]) { if (argc == 2) { ...
0
votes
1answer
68 views

CS50 Week2 capital letters bug

I'm trying to complete the vigenere code assignment but sadly, despite it seemingly working great with lowercase letters, it completely bugs out with capital letters. This is how it looks like with ...
0
votes
1answer
47 views

Pset2 Readability undeclared identifier error message

I am attempting to make my program but everytime I try, it tells me I have not identified my variable "i" eventhough I identified it as an integer above. Does anyone know what I'm doing ...
0
votes
1answer
81 views

Road block again!!! Caesar pset2

What does this mean?: ":( handles lack of argv1" My code passed all the checks except for this one.
0
votes
1answer
444 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
52 views

Pset2 Caesar Hail dont know how to encrypt the plaintext

plz help me refine my code thx!! https://raw.githubusercontent.com/check50/davil3388/cs50/2017/fall/caesar/caesar.c?token=Aehv0R6qUjbNWPi_rOMKjS7ChP3tSlW1ks5aSK8MwA%3D%3D
0
votes
1answer
214 views

Pset2 Caesar variable problem

I can't figure out whats wrong. Here's my code: //argc and argv allow to for users to input data before the program runs. int main (int argc, string argv[]) { //Do-while loop to ensure user ...
0
votes
1answer
340 views

CS50 PSET2 code will not compile

I would appreciate any help that could be given with my code below (+ error codes below that): My code will not compile and the primary error apparently is an "undeclared identifier" refering to ...
1
vote
3answers
1k views

Can't run the staff implementation

i can't run the staff implementation for any problem set, i always get the same error, it's always something like : bash: ~cs50/pset4/breakout: No such file or directory
0
votes
1answer
147 views

I need help using isupper/islower and converting ASCII to Alphabet for Caeser PSET2

Beginner coder here. I'm working my way through caeser but can't seem to understand how I would implement isupper/islower to preserve case, or change ASCII to alphabet. Here is my code so far and it ...
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
115 views

problem with pset 2 initials (more confortable)

im having a problem with initials (More Confortable) in Pset2. The ckeck50 software outputs this: : ( outputs "MB" for " milo banana " \ expected output, but not "MB\u0000\n" But when i try to run ...
0
votes
1answer
209 views

pset2 Vigenere: Problems Applying Key & Case

for (int i = 0, n = strlen(p); i < n; i++) { if (isalpha(p[i])) { if (isupper(p[i])) { char stringshifttext = ((((p[i] - 'A') + (k[i % strlen(k)] - 'A')) % 26) ...
2
votes
1answer
297 views

pset2 crack password does't work

I'm trying to make pset2 crack but having so much problems and my head is about to explode. Here is my code; my first error is on line 41. I never get to pass a value to the key for crypt. I'm very ...
0
votes
1answer
238 views

Problem with caesar cipher encryption

I'm trying to solve pset2 Cesar encryption.Everything seems fine and encryption is working but when I hit check50 I get errors: :( encrypts "a" as "b" using 1 as key expected prompt for input, ...
0
votes
2answers
316 views

crypt key char concatenation (pset2/crack)

I have created a series of for loops to iterate through every combination of a 4 letter long password (i j k l). I wish to enter each iteration into the crypt function but what I have been trying has ...
0
votes
2answers
70 views

On running as ./a.out <keyword>

On running as above the program shows segmentation fault. Why is it so? The program is for pset2 vigenere.c . What I am doing is storing the key in a string and then storing the integer value of key ...
0
votes
1answer
83 views

Please help!! pset 2 cannot successfully create a loop for "k"

#include <cs50.h> #include <stdio.h> #include <string.h> int main (int argc, string argv[]) { string k= argv[1]; string p = argv[2]; if (argc==2) { p=GetString(); ...
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 ...
1
vote
1answer
286 views

How can I find pythons equivilant of C's crypt function?

I am current working on 'sentimental'. However, I am having trouble finding the equivalent function of crypt used with "crypt.h" in C? I already have an algorithm for enumerating all possible ...
0
votes
1answer
111 views

Pset2: Vigenere Cipher, wrong output

In the following code there is no compiling error, but it does something wrong, as it gives me a wrong output. What it is supposed to do is: when the key is 'a' and the plaintext is 'a', output 'a', ...
0
votes
1answer
79 views

check50 in pset2

I won't post my code, because, as far as I could tell, it works fine, but I keep on getting this when I run check50 and I don't know know exactly what it means or how to fix it. My code runs perfectly ...
0
votes
0answers
8 views

error: address of stack memory associated with local variable

I have the following function: string encipher( string plaintext, string key) { int size = strlen(plaintext); char ciphertext[size]; // For each alphabetic charaters determine what letter ...
0
votes
1answer
94 views

Vigenere.c: got stucked with this program

I got stucked with Vigenere.c problemset2. With this program the user must prompt a command line keyword that will be used to encrypt a plaintext that the user will later enter. In particular for ...
1
vote
1answer
172 views

Initials and Vigenere pass CS50 but received 0 in Gradebook

I submitted pset2 after completing all programs, manually checking for correct functionality and ensuring all programs passed check50. However, I received 0 on both initials and vigenere. I waited 2 ...
0
votes
1answer
104 views

pset2 How to get rid of spaces in the end of the milo banana_ _ _ _ (input)?

How to get rid of spaces in the end of the input? My code works perfectly with _ _ milla_ _ _ banana But I have issues with the case if _ _ _ milla_ _ banana_ _ _ when I have spaces in the end How ...
0
votes
2answers
94 views

Initials.c isnt working properly

This is my code #include <cs50.h> #include <stdio.h> #include <ctype.h> int main(){ int i=0; printf(""); char* str = GetString(); printf("%c",*str); while(str[i]!='\...
0
votes
1answer
146 views

CS50 pset2 caesar

I am busy with CS50 pset2. I am trying to interpret the error message received: :( encrypts "BaRFoo" as "FeVJss" using 4 as key \ expected output, but not "ciphertext: FeVJss" My programme ...
0
votes
1answer
374 views

Approach to pset 2?

I'm having problems with pset2 initials. My approach to it is to ask the user for input, and store that input into an array and print the individual initials from there. However, when I use the argv[] ...
0
votes
1answer
117 views

CS50x - Problem Set 2 - Initials (less)

I've managed to whip up a solution in Python 3 that seems to work. name = input("") initials = name[0] for i in range(0, len(name)): if (name[i].isspace()): initials += name[i + 1] ...
0
votes
1answer
143 views

PSET2 Initials task

My code has a bug in it which make it output the first initial after the second, would someone please be able to help me and describe what is wrong without having to change my whole code as it all ...
0
votes
1answer
130 views

Pset2 Caesar won't compile

My code won't compile and I can't tell why. All of the error messages I'm receiving are regarding my "for" statement and my use of the variable i. I also get an error message about my use of "string" ...
0
votes
1answer
182 views

My caesar cypher is not cyphering right, can anyone please help?

The code executes but simply prints out the wrong output. For example, when I provide a key of 'a' and then ask for 'aaaa' to be converted, the code prints out 'cccc' instead of 'aaaa'. I can't figure ...
0
votes
1answer
243 views

I've use array pointer method in pset2 (initials.c) but it return "Segmentation Fault (Core Dump) Why?

I'm working on pset2 using array pointer method, but unfortunately, the program return "Segmentation Fault (Core Dump)" I've post a picture of my code below.Can I use this method? or I have to use if ...
0
votes
1answer
145 views

Pset 2 Initials less comf my code works and passes the test but I would like to know how differenlty could have been implemented

I got initials less comf. pretty quickly thankfully but I would like to know how you guys have implemented the code differently than me. https://gist.github.com/a50582c43587cd3c45d38e9e0c4f956a
0
votes
1answer
160 views

Pset2 vigenere formula

My formula for vigenere is not quite right, and I'm not sure which part is wrong, could someone leave me some bread crumbs please int j = 0; int upperk = key[j % klen] - 'A'; int lowerk = key[j % ...
0
votes
1answer
72 views

pset2 vigenere. My code handles text inconsistently

I've got it working nearly perfectly. It works if the text is in lowercase, but I see that it's not working quite right when using uppercase. In check50 it only fails with lowercase: encrypts "BaRFoo"...
0
votes
2answers
48 views

Can't pass the test on readability

So, I think function 'round' in one case does rounding to the Grade 8, instead of Grade 7. But, if I remove it, another text getting wrong grade. in both cases the grade of either one text is wrong. ...
1
vote
1answer
117 views

Vigenere print error

I've got my code to cycle through the plaintext index p and the key index. However I keep getting an error when I am printing and can't figure it out. When I use the test spec using bacon as the key ...

1
2 3 4 5
25