Questions tagged [pset2]

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

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

pset2 vigenere, wont find key in position j the second time around

i really didn't want to ask on here but i cant see the problem for this really strange result. im not 100% finished with this code, i was just checking my algorithm was working before completing it. i ...
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
0answers
58 views

pset 2 ceasar alphabet index and isalpha questions

hi guys im watching online cs50 and i have some questions about ceasar this is my test code to make shure everything work and queastion is how can i use isalpa() function correctly and where i should ...
0
votes
0answers
99 views

Vigenere Cipher not working!

This is my code for enciphering my plaintext : #include <stdio.h> #include <cs50.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <ctype.h> ...
0
votes
1answer
160 views

Pset 2 Initials - Function Help

I've written a successful program to complete the Initials section of Pset2 without the use of any functions. However, seeing as I needed to copy/paste a good chunk of code in my program I've decided ...
0
votes
1answer
58 views

Pset 2 vigenere failing one check using Baz as keyword

Took me awhile to figure out the logic behind this project. I thought I had it all worked out but I keep failing one check. :( encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword \ expected ...
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
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
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
164 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
0answers
65 views

Please help, i keep hitting segmentation faults on this code

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <stdlib.h> #include <string.h> int main(int argc, string argv[]) { if ( argc > 2 || argc < 2 ) ...
0
votes
1answer
452 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
61 views

pset2: vigenere different output

So, I just finished with my vigenere code but the output is different from the expected one. I'm posting my code and hope any of you guys finds my mistake and gives me a tip. #include <stdio.h> ...
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
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
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
0answers
48 views

Vigenere program is not working correctly!

I think the keyword is not repeating itself. Kindly help! string p = GetString(); int a; for (int i=0, n=strlen(p); i<n; i++) { if (isupper(p[i])) { ...
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 ...
0
votes
1answer
70 views

Vigenere Cipher: Cant get whats wrong

I am not able to guess what is wrong i never was able to understand is alpha thing but i tried to do some debugging and it is printing the non alphabetical characters twice. #include <stdio.h> #...
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
2answers
296 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
0answers
117 views

Why can't I create an array of strings?

I have this habit of first trying out all the exercises of the book then going on to psets. I am on chapter 7, arrays. the question was to make a program of some sort of voting counter and instead of ...
0
votes
0answers
51 views

pset2 ceaser question about wraparound text and argc

here's the code (only look if you've completed this section!): http://pastebin.com/xNV5VJAw I was able to pretty quickly write a program the moves characters by k spaces, but I can't get it to wrap ...
0
votes
1answer
198 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
0answers
36 views

vigenere.c exists , recieving :( on the first check

:( vigenere.c exists \ expected vigenere.c to exist This must be a server end problem ,Is there anything I can do to resolve it or should I wait. I have tried checking it thrice but still am not ...
0
votes
1answer
109 views

i cannot increase my key correctly :(

#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <string.h> #include <ctype.h> //Declare variables //check user's input value ...
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
1answer
68 views

My code cipher un correctly i dont no why ??I want to cipher letters with a key ASCII value

[code hidden per academic honesty guidelines]
0
votes
1answer
159 views

Pset2 Vigenere text is not encrypted properly

My code seems not able to cipher the text correctly, tried to figure out the problem but failed... Can any help me? Below is my code, thank you. #include <stdio.h> #include <cs50.h> #...
0
votes
1answer
123 views

Don't know why my code can't use modulus

Don't know why my code can't use modulus. for (int i = 0, n = strlen(text); i < n; i++) { a = text[i]+key; b=a%26; c=65+b; printf("%c", c); }
0
votes
3answers
279 views

pset2 initials video

I have figured out how to do some of this on my own, but I've spent over an hour just searching for the videos on the subject! I have no idea where the uppercase was introduced, or where pulling ...
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
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
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
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
210 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) ...
0
votes
1answer
248 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
0answers
54 views

Small question with how NULL works

this is just a small question on NULL. In the snippet below, why doesn't the do-while loop repeat when I don't enter anything for the string? #include <stdio.h> #include <string.h> #...
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
0answers
58 views

Why isn't my solution to pset2 graded yet?

I have successfully uploaded a solution to pset2 on 11 Auguest 2015. On Thursday, 10 September 2015, 17:42, I wrote to Rob: Dear Rob, My problem pset2 does not appear to have been graded so ...
0
votes
1answer
84 views

SZZ output for Vigenere

This seems to be a faq on this problem set, although I looked at all other answers that pertained to this problem, I have been unable to fix the error. I am having trouble with one check50 spec where ...
0
votes
1answer
150 views

Applying wrapping key

I have been stumbling over vigenere problem from pset2. I am trying to iterate wrapping around text, compiler systematically yells at me. #include <stdio.h> #include <cs50.h> #include &...
0
votes
1answer
106 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
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
0answers
53 views

Cipher Text Computation Error

Like others here I have tried everything to get my cipher code to work correctly. I feel like I have a great understanding of what to do, but for I just can't seem to see where my math is going wrong. ...
0
votes
1answer
137 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
0answers
115 views

pset2-->vigenere: check50 says my results wrong, while my program prints same results as check50

in pset2 --> vigener.c I wonder why if my program is printing correctly 3/4 of the cases tested by check50, check50 still mark them as wrong. HAVE A LOOK TO THE PHOTO (both photos have same info but ...
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
0answers
98 views

pset2 ceaser cipher

how can I return to a ? #include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int main(int argc,string argv[] ) { int i; int key = atoi(argv[1]); for ...
0
votes
1answer
192 views

argv, getting: EXC_BAD_ACCESS (code=0, address 0x0)

First off, I don't have the appliance, I had to place cs50.h in the same directory as my source code. As you will see from my code I did provide the correct header for that situation. The error in ...