0

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.c exists
:) caesar.c compiles
:( encrypts "a" as "b" using 1 as key
   \ expected output, but not "b"
:( encrypts "barfoo" as "yxocll" using 23 as key
   \ expected output, but not "yxocll"
:( encrypts "BARFOO" as "EDUIRR" using 3 as key
   \ expected output, but not "EDUIRR"
:( encrypts "BaRFoo" as "FeVJss" using 4 as key
   \ expected output, but not "FeVJss"
:( encrypts "barfoo" as "onesbb" using 65 as key
   \ expected output, but not "onesbb"
:( encrypts "world, say hello!" as "iadxp, emk tqxxa!" using 12 as key
   \ expected output, but not "iadxp, emk tqxxa!"
:( handles lack of argv[1]
   \ expected output, not standard error of "/opt/sandbox50/bin/run.sh: line 31:  76..."

jharvard@appliance (~/CS50/Pset2): check50 2014/x/pset2/vigenere vigenere.c
:) vigenere.c exists
:) vigenere.c compiles
:( encrypts "a" as "a" using "a" as keyword
   \ expected output, but not "a"
:( encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword
   \ expected output, but not "xoqmd, rby gflkp!"
:( encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword
   \ expected output, but not "=aKAoh"
:( encrypts "BARFOO" as "CAQGON" using "BAZ" as keyword
   \ expected output, but not "=;KAIH"
:( handles lack of argv[1]
   \ expected output, not standard error of "/opt/sandbox50/bin/run.sh: line 31: 261..."
:( handles argc > 2
   \ expected output, not an exit code of 1
:( rejects "Hax0r2" as keyword
   \ expected output, not an exit code of 1*

My program works exactly as the implementation by the staff works. Why is check50 showing these errors?

1
  • Your program may work correctly but if your output is not the same as check50 expects, then you get your errors. Read the answer of @curiouskiwi
    – user2477
    Commented Nov 14, 2014 at 7:14

1 Answer 1

0

First, I expect that your program isn't exactly like staff's.

When you run it, do you see this?

jharvard@appliance (~/Dropbox/pset2): ./caesar 1
a
b
jharvard@appliance (~/Dropbox/pset2):

or do you see this (which check50 will refuse)

jharvard@appliance (~/Dropbox/pset2): ./caesar 1
a
bjharvard@appliance (~/Dropbox/pset2):

Can you see the one thing that you are missing? That will fix almost all of your check50 errors on both caesar and vigenere.

As for the second problem, check50 is crashing when it runs the program without any command line argument.

What happens when you run this?

jharvard@appliance (~/Dropbox/pset2): ./caesar 

or

 jharvard@appliance (~/Dropbox/pset2): ./vigenere 

Does your program print an error message to the user and then quit? As the spec says you must do?

What about this?

 jharvard@appliance (~/Dropbox/pset2): ./vigenere A12!

Does your program print an error message to the user and then quit? I suspect it simply quits.

Fix those things and you should be fine.

1
  • Thank you! Now it works perfect! I thought that check 50 was expecting just the result and didn't care about the change of line! Commented Nov 14, 2014 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .