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
2answers
178 views

Pset2 Initials, will only get output if there is /n

I only seem to get an output when the 2nd %c is followed by \n. When it is there, the initials print, but they are subsequently on different lines. This is due to the \n. But when I remove it, ...
0
votes
1answer
189 views

Help with Vigenere - converting digits to lowercase and issue with looping around with %

Alright, so I'm working on vigenere and I have two main problems. When the key is longer than the input, the output content is correct, except it is all uppercase (note that I have code to make it ...
0
votes
2answers
294 views

pset2 initials checking problem?

So I wrote my code for initials and when I test it myself everything runs perfectly, but when I check it using check50 2015.fall.pset2.initials initials.c the checking program says that I have the ...
0
votes
1answer
166 views

PSET2 caesar problem, This code has some problems

This code is encrypting till the key is 25, from 26 to above it is not giving output for lower case.In upper case with the key of 2 its output of "AAA" is "CACACA" rather than "CCC". It is not giving ...
0
votes
1answer
67 views

PSET2 Initials.c initials not being printed out at all

My code just stops after I get the string from the user, and I'm not sure why it isn't continuing. Any pointers? int main (void) { printf("What is your full name?\n"); string s = get_string()...
0
votes
1answer
139 views

PSET 2 - Vigenere

For some reason my program seems to be.. half-working? I have gone over my code over and over and I honestly can't figure out what I am doing wrong. Hopefully someone here can.. This is a snippet ...
0
votes
1answer
149 views

Segmentation fault using get_string()

Working on pset2: "initials.c" ... my code runs fine, outputting the expected initials when it opens with a statement such as string s = " John J Smith"; (which I used during programming to avoid ...
0
votes
2answers
568 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
2answers
188 views

Caesar output extra characters in capitals only

My caesar code works well for lower case but adds extra characters for upper case even though I used the same strategy in coding. :( encrypts "BARFOO" as "EDUIRR" using 3 as a key \ expected output, ...
0
votes
3answers
20k views

How to Wrap Around Array Indexes?

I have the Vigenere encryption portion working properly, but can't seem to figure out how to wrap around argv[1] indexes. My first for loop declared two ints, i and j, and incremented each int with ...
0
votes
2answers
312 views

Help! Problems on pset2 initials

I have a problem of running this code. when i try to complie, it keeps repeating on the same warnings. Here's my code. Here's the warning: initials.c:14:12: error: expression result unused [- Can ...
0
votes
1answer
141 views

pset2(Alternative Solution opinion

I know theirs a billion ways to implement a solution , heres what i came up with and it passed all the tests. What do you guys think int main(void) { string name = get_string(); void ...
0
votes
1answer
689 views

Problem with atoi() function in problem set 2

I can't make int k = atoi(argv[1]); work; I've included stdlib and tried a variety of things but the program doesn't like it no matter what I've tried. The program compiles OK, but when I run it, it ...
0
votes
1answer
788 views

Check50 shows standard error messages from /opt/sandbox50/bin/run.sh

I have been struggling with pset2 (despite I have done pset3 and 4) for weeks because I always get this message from check50: *Checking.....................................................:) caesar....
0
votes
1answer
36 views

cs50 Pset2 *Spoiler*

#include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { //create key string key = ...
0
votes
2answers
297 views

Pset2 Vigenere "expected output, not a prompt for input"

When I checked my program, everything worked except Hax0r2. It says expected output, not a prompt for input Last time I came across this problem, it had to do with not including printf. But this ...
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 ...
1
vote
1answer
737 views

Vigenere fails check50 test "encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword"

I successfully completed the Vigenere program and I was recently testing it with Check50. My problem is that there is only one test that fails, and I don't know why: :( encrypts "BaRFoo" as "CaQGon" ...
0
votes
1answer
36 views

pset2 mathematical IF statement : attempt

#include <stdio.h> #include <string.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <cs50.h> int main ( int argc, ...
1
vote
1answer
167 views

Pset2 Crack - works for one password 50i2t3sOSAZtk--->(lol), but not for other passwords - why?

this version of crack works for lol, and prints the following: new hash = 50i2t3sOSAZtktr [what is the 'tr' at the end???] lol for other passwords, the program never returns a decoded pw, just ...
0
votes
2answers
140 views

check50 pset2 cs50 2017

I ran the check50 command on the terminal window for my program caesar pset2 but I am unable to understand the error message in red as follows : :) caesar.c exists :) caesar.c compiles :( encrypts "a"...
0
votes
1answer
353 views

command line arguments help to use them in the program

I'm not sure how to include the input from the command-line arguement. I try to set the arguments equal to variables, bu it's not working. #include <stdio.h> #include <cs50.h> int main(...
2
votes
1answer
207 views

pset2 Initials Design Improvements

I was hoping you might be able to help me improve the design of my code. I've solved the initials problem, and it passes check50 on both normal and hacker edition (the hacker edition was incidental), ...
1
vote
1answer
112 views

Creating an array of unknown indexes. pset-2

I'm working on crack and while I've been able to iterate over an array to create possibilities to test (i.e aaaa, aaab aaac etc.) I can only do it knowing the amount of indexes the array has, I tried ...
0
votes
2answers
94 views

pset2 Vigenere printf of encrypted string shows 'funny' chars but looping through doesn't. Why?

The first line under // Return when uncommented prints funny chars sometimes ... always when the message to encrypt is one char long. But when looped through as in the block two lines below // ...
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
1answer
249 views

PSET 2 Vigenere Cipher .Capital letters in keyword

Hi all i'm currently facing problems when it comes to encrypting keywords with capital letters in it. I have checked my code on check50. but it still fails when entering keyword like Baz and BAZ with ...
0
votes
1answer
95 views

I have some problems with vigenere

My English is not quite good, and it's difficult to understand videos and lectures cs50. I have some problems with vigenere. Maybe I do something wrong, help me please. #include <stdio.h> #...
0
votes
1answer
162 views

I'm on pset2 vigenere.c. need help with encryption

I've been struggling with vigenere for months. please help me to figure out my errors and guide me clearly. any help much appreciated. #include <stdio.h> #include <cs50.h> #include <...
0
votes
1answer
107 views

Vigenere acting odd

I have spent hours trying to figure out why my vigenere check50 does not completely work and I was wondering if anyone here could help me. string k = argv[1]; //iterates through the ...
0
votes
2answers
931 views

Segmentation fault: cannot replace character in string

string increment(string s, int loc) { char c = s[loc]; c += 1; s[loc] = c; return s; } increment("A", 0); returns Segmentation fault at s[loc]=c;and I have no idea why. Is there a specific ...
0
votes
1answer
76 views

Pset 2 Vigenere, new to coding and cant find the problem

I am very new to coding and cant tell where the problem with this is. It does compile however when run it returns the string exactly as it was input, including non alphabetic characters. I'm unsure of ...
0
votes
1answer
475 views

Undefined reference to "get_string" (pset2, ceasar)

My code isn't compiling. I'm getting "undefined reference to 'get_string'" I think there is an issue with the way i have contextualized the first part of my code, i.e., above the "for" loop. I'm not ...
0
votes
1answer
188 views

Steps to cipher text

I kind of know what to do... just having a hard time getting my head around it! This is my thinking: once I have asked the user for some text to cipher, I need to check if the text is indeed alphabet, ...
0
votes
1answer
97 views

correct output except 'a' and 'z' or 'A' and 'Z'

I think i almost did vigenere pset. but output is strange. in 'baz' key: b is correct it increment 1 point but also a increment 1 point and z increment 1 point instead of subtract 1.. İt doesn't make ...
0
votes
2answers
282 views

How do i pass an array into a function?

I have tried passing arrays into functions but I keep getting an error about pointers. So is it possible to pass an array I initialised in my main function to another function I created without using ...
0
votes
1answer
201 views

SEGmentation fault caesar (pset2)

It has been more then a week and I am unable to fix this problem. I double checked everything but I still get this error with capital letters. Can anyone help please? Here is the code I have for this:...
0
votes
1answer
134 views

vigenere.c not printing correctly for some reason

Code: #include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int main (int argc, char *argv[]) { if ( argc != 2 ) { printf ("ERROR 1\n"); ...
0
votes
2answers
427 views

pset2 vigenere wraparound

I can't figure out how to wrap the k[i] in the formula c[i] = (p[i] + k[i]) % 26 I know the if and else code's are different, that's to illustrate the main implications I've tried. also the printf("%...
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
2answers
51 views

Why the if statements don't work when I put them into loops? Caesar PSET2

Help, please. The program works fine until I want to add the loops and when I do that the if statements inside it won't work and it will just ask for the key and will output the same text as the input ...
0
votes
1answer
24 views

CS50 Pset2 Readability Second Argument Not Compiling

#include<stdio.h> #include<math.h> #include<cs50.h> #include<ctype.h> //prototype for a custome function int letters, words, sentences(string text); int main(void) { // ...
0
votes
1answer
29 views

I've been trying to submit ceaser and it won't compile can someone help?

#include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> #include <ctype.h> #include <stdlib.h> //atoi ? bool is_valid_key( string s); // ...
0
votes
1answer
31 views

Pset 2, readability: is everything a float and rounding problems

I' at the very end of readability and am having trouble getting the math correct and rounding it. I'm getting the correct letters, words and sentences, but am getting wildly wrong values for the grade ...
0
votes
1answer
13 views

Pset 2 ceaser problem

it,s compiling but it is not checking the words are digits or alphabets neither it is printing I included all the header files I don,t know what is going on.
0
votes
2answers
74 views

How to invoke command line argument functions outside of main? caesar.c

Let us say I want to create a separate function for lines 11-25 (check comment for reference) in my code as a separate "argument checker" function. Something similar to how I have my decrypt ...
0
votes
3answers
679 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
459 views

Don,t know why it is not printing each char after space

I have written this code to print first char and each subsequent char after "space" to be printed, but it is only printing first char what is the problem. #include <stdio.h> #include <cs50.h&...
0
votes
0answers
6 views

pset2 readability critique - how does my code look?

after struggling for days on end with scrabble, I decided to really spend my time consuming all the information possible from notes/lectures/shorts etc. Just finished readability only taking a few ...

1
2 3 4 5
26