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

Trying to get all values from a string in an array

My program increments the second character by 27 letters (modulo operator there so it wraps around). My issue is that I don't only want one character incremented but the entire string. I tried ...
0
votes
1answer
73 views

For loop doesn't start

I'm trying to create a function which will evaluate whether or not the user's command line input is a letter. The function returns an integer, which should be zero if the string is all alphabet ...
0
votes
2answers
409 views

vigenere cipher formula

I am having trouble with the cipher formula. I am working on just getting lowercase character right using the keyword "bacon" and plain text string "test". I get a result of "nxna". Any help is ...
0
votes
1answer
176 views

Vigenere - Everything works except using capitals with lowercase

I got a lot to work in my code, except when I check it, it prints out the right encryption until I use capitals, yet I thought my capitals code was just fine. So if I use a key of abc, then it should ...
2
votes
1answer
265 views

Expression result unused in Vigenere

I am getting this error: expression result unused and I don't know what that means. I use the code it's pointing to (green underline), just like I do in my Caesar cipher which works: The other posts ...
0
votes
2answers
212 views

Weird printout from caesar when storing the encrypted code in an integer array

I am just getting lost and overloaded. Been looking at this for 2 days. I think something is wrong, since my text does not get encrypted after I enter it and then hit enter. I get a weird print out in ...
0
votes
1answer
2k views

pset2 vigenere help [closed]

OK, I have tried everything, but there still seems to be something wrong with my code for vigenere cipher. I mean I can't get it to loop through the keyword when the word is longer than it. I swear I ...
0
votes
1answer
218 views

Keyword looping

I'm stuck halfway in vigenere. This is some of my code. When I tried to work that out, something went wrong. Kindly appreciate any help.
1
vote
1answer
2k views

Is it possible to re-submit the a problem-set and get another grading? [duplicate]

I kinda did wrong in Problem2 Code and when I fixed it, I re-submitted, in that case, am I gonna get a new grading?
0
votes
1answer
553 views

Vigenere problem with Check50!

I used check50 to check vigenere.c, and I got this result. Even the staff's code has the same output as mine! Don't know where's the problem! I've seen questions of this sort but the answers weren't ...
0
votes
2answers
232 views

Vigerenere.c not shifting correctly

// makes sure we have the correct amount of command-line arguments if(argv[1] == NULL || argv[2] != NULL) { printf("To use this program, please give me a command-lind argument of the key you want ...
0
votes
1answer
1k views

What does "expected output, not an exit code of 1" mean from check50? [duplicate]

When I write check50 2014/x/pset2/caesar caesar.c in the command line or the terminal this is what happens: :) caesar.c exists :) caesar.c compiles :) encrypts "a" as "b" using 1 as key :) encrypts "...
0
votes
1answer
415 views

Vigenere Loop Not working [closed]

I am having trouble with vigenere; I can't loop the argv[] with the string[] and then starting again.
1
vote
1answer
482 views

Pset2 Vigenere. Works for lower and uppercase letters separately, but not for whole code

I've worked on (and dreamed about) Vigenere for a few days now, and I'm almost there. I think! If I try out my code separately for lower and uppercase letters (by commenting out the irrelevant part), ...
1
vote
2answers
768 views

pset2 (vigenere) - Check50 error problems

I'm stuck on an issue with my code. After completing my code and making sure it works as should, I run check50 and this is what I get; jharvard@appliance (~/Dropbox/pset2): check50 2014/x/pset2/...
0
votes
2answers
497 views

How do I loop the keyword in vigenere.c?

I am currently working on vigenere in pset2 and I cant figure out how to loop the keyword back around until the entire text is encoded. These are the errors I am getting from check50: :) vigenere.c ...
0
votes
1answer
133 views

Segmentation Fault and Connection Issues

I always see this error segmentation fault (core dumped) I am at the point of breaking can't seem to figure out what's wrong. Check50 is not working, says you are not connected to the internet, but ...
0
votes
1answer
358 views

Why does my Vigenere solution give the wrong output only at certain positions in the string?

I have got a problem with vigenere: :) vigenere.c exists :) vigenere.c compiles :) encrypts "a" as "a" using "a" as keyword :( encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as ...
1
vote
1answer
638 views

Pset2 (ceasar) - check50 doesn't work

I have a big problem with pset2. I got 0.5 although both programs (vigenere and ceasar) work fine when I test them on my own, without check50. I got 100% for vigenere, and 0% for ceasar. Do you know ...
0
votes
3answers
2k views

Segmentation Fault and Returning 1

If I declare int key before my if (argc != 2), I get a segmentation fault (core dumped) message when I run the program with only one command-line argument. However if I declared int key after the if ...
0
votes
3answers
662 views

Segmentation fault in Caesar while accessing a char of a string

In my code, I have declared a string var c, for holding the . After adding the key, when i access a particular character using c[i], it gives me a 'segmentation fault (core dumped)'. I was able to ...
0
votes
1answer
54 views

Is it "OK" to leave out the variable `n` in the "capitalize" walkthough from pset2?

I normally watch the video and then switch to my editor program and rebuild it out of memory following my logic and the tools I just learned. So I programmed it a little bit different and wondered if ...
-1
votes
1answer
372 views

What's Wrong in My Code for Vigenere?

Here's my pseudocode for vigenere cipher: for (i from 0 till strlen(s)) { if(ith letter is capital) { s[i] = s[i] + key[i % length of key-string] - 65 print s[i] (after checking if ...
0
votes
4answers
988 views

How to Encrypt Plaintext Properly When it Contains Non-Alphabetical Chars?

My caesar.c doesn't encrypt plaintext properly when there are non-alphabetical chars in my plaintext word. Here's my code for encryption: int k = atoi(argv[1]); string plain_text = GetString(); // ...
0
votes
1answer
2k views

How to Handle "rejects "Hax0r2" as keyword" in Vigenere?

So I made my Vigenere program and it passes all the tests except for the last one about not accepting keys with non-alphas. Now, I have a check in my program to stop this, and when it detects a non-...
0
votes
1answer
208 views

vigenere ciphering loops

My vigenere program works for everything except for when I have both capital and lowercase letters in the keyword. It works when I have only one type, so I don't think it is a problem with the formula,...
-1
votes
3answers
531 views

I need help here Vigenere problem .how to wrap around my program idont know how

#include<cs50.h> #include<stdio.h> #include<string.h> #include<ctype.h> int main(int argc, string argv[]) { if(argc !=2) { printf("enter your key first "); ...
0
votes
2answers
388 views

vigenere ciphering formula

my vigenere program isn't doing quite what it's supposed to so I was wondering if anyone could tell me if my formula is correct. I don't need the answer, just which part (if any) of the code I post is ...
0
votes
1answer
831 views

vigenere cypher issues with embedding loops

So I have two for loops, one to run through the key word and one to run through the plaintext. Thing is, when I put the first one on top of the second, the second only uses the last result of the ...
3
votes
1answer
1k views

Why doesn't caesar pass check50 even though the output is correct?

I have solved caesar, but check50 is not recognizing my results as correct. :) caesar.c exists :) caesar.c compiles :( encrypts "a" as "b" using 1 as key \ expected output, but not "b" :( encrypts ...
0
votes
1answer
126 views

Why Doesn't Vigenere Give the Correct Output?

Hy guys , i have almost finished with vigenere.c and when i did several tests it was doing well , but when ai tried to encrypt "Meet me at the park at eleven am" using as a keyword "bacon" that's the ...
0
votes
1answer
162 views

Code doesn't work for some inputs

I'm having some issues with caesar. Some things work, others don't. For example check50 says: :) encrypts "a" as "b" using 1 as key :( encrypts "barfoo" as "yxocll" using 23 as key \ expected ...
-1
votes
1answer
335 views

Ignoring Non-Alphabetical chars in Vigenere [duplicate]

I do not control?? do so each independent encryption if uppercase text and key do this if key lowercase text and do this if uppercase - lowercase text and key do this if lowercase - uppercase text ...
0
votes
1answer
6k views

Why do I get "redefinition of a variable with a different type " error?

Per the pset2 specifications, I am using string k = argv[1]; int k = atoi(argv[1]); to turn the input from a string to an int but when I try to compile I get: caesar.c:16:5: error: redefinition ...
2
votes
1answer
697 views

Ascii Becomes Negative?

So I'm I just started pest 2 and it was pretty smooth until I found a horrible bug in my code. Essentially the code works fine when the entire plain text string is in upper case, but it gives me a ...
2
votes
1answer
623 views

Failing one test case with check50 on pset2 - encrypts "say" to "szz" instead of "rby"

encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword # Checks 0 Running... clang -o vigenere vigenere.c -lcs50 -lm. ✔ 1 Expecting an exit code of 0. ✔ 2 Running... ...
0
votes
2answers
19k 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
1answer
994 views

Is ROT26 reference in pset2 a joke?

When I was reading the pset2, I found this line. Incidentally, a Caesar cipher with a key of 13 is generally called ROT13 (cf. http://en.wikipedia.org/wiki/ROT13). In the real world, though, it’s ...
0
votes
3answers
1k views

How to Ignore Ciphering Non-Alphabetical Characters in Vigenere?

I get these 3 errors when checking viginere with check50 :( encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword \ expected output, but not "xomqd, szz gflkp!\n" :( encrypts ...
0
votes
2answers
237 views

Vigenere pset2 code runs one extra loop when non-alpha entered

My vigenere code enciphers properly, but if a non-alpha (i.e. space or number) character is entered in the code to be ciphered, it loops through an extra time. It doesn't matter whether it is one non-...
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
1
vote
2answers
120 views

Line length too long

I just finished the Caesar program and it works, but when I run style50 it complains that this line is too long: if ((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && ...
0
votes
1answer
406 views

I got a error from check50 after ":( handles lack of argv[1]" [duplicate]

If I pass a wrong argument the program exits but when I run check50 it shows an error:
0
votes
1answer
336 views

Problem Set 2 Standard Edition Check 50 vigenere Error

When I run my vigenere.c in the appliance it behaves exactly like it should. But when I run check50 I get the following output: :( encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as ...
5
votes
4answers
7k views

How to handle the lack of argv[1] in caesar?

I think my program handles lack of argv[1] correctly, yet it fails check50's test. here my code: if ( argc != 2 ) printf ("usage : ./caesar + key \n"); return 1;
1
vote
3answers
5k views

Segmentation fault (core dumped) in caesar

After starting caesar with an additional argument and providing the sentence that needs to be encrypted, the Terminal shows this response: jharvard@appliance (~/Dropbox/pset2): ./caesar 1 abcdef ...
1
vote
4answers
792 views

Vigenere Cipher Doesn't Work Properly

I have been trying for way too long to make my Vigenere cipher work, but now I am so confused I don't even know what I am doing. I need some guidance in what it is that I am doing wrong. When I ran ...

1
21 22 23 24
25