0

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 that helpful because I didn't understand them. Please help!

3

1 Answer 1

2

Check50 works by running your program with specific inputs, then checking that your program produces some specific output, and/or returns a specific value. It will display the values given to your program as input, and the values your program returned as output.

Check50 will do this multiple times with different inputs to check that your program works correctly under various conditions.

Take the first error as an example (it looks different here because it's text, but its essentially the same output you get from check50).

 0  Running...  clang -o vigenere vigenere.c -lcs50 -lm. ✔
 1  Expecting an exit code of  0. ✔
 2  Running...  ./vigenere a. ✔
 3  Takes in standard input of  a.  
 ... but received the following on standard out instead — Your plaintext: 

Going through it line by line:

 0  Running...  clang -o vigenere vigenere.c -lcs50 -lm. ✔

This means your program compiled, which is the correct behaviour.

 1  Expecting an exit code of  0. ✔

This means your program ran, and returned 0 from a return function somewhere. This is what check50 was expecting for this test so it correct.

 2  Running...  ./vigenere a. ✔

This is telling you that check50 ran your program vigenere, passing the argument a. This is exactly the same as if you had typed the command to run the program.

 3  Takes in standard input of  a.  
 ... but received the following on standard out instead — Your plaintext: 

This means your program was also given the value a as input. At this point check50 is expecting your program to "take in standard input" the value of a. However instead of just taking the input, your program instead outputted Your plaintext:.

From this you could infer that your program should not output any prompt, but instead just wait for input using a function like getString().

Looking at the remaining errors, three others are reporting the same problem, just under different conditions. The final three errors are for a different reason, for example:

Expecting any sort of standard out. ... but received an exit code of  0

Here check50 is telling you that it's expecting your program to output some message, but the program is instead returning before outputting anything.

3
  • Thank you for your reply, it opened my mind for such thing! Now I have another problem handles lack of argv[1] I've tried every condition to handle it but still I got the same error LINK Commented Aug 7, 2014 at 16:26
  • This is saying that the code needs to handle the condition where the program is run without any arguments. So if I run ./vigenere without any arguments, they are expecting something specific to happen. So you need a way to check how many arguments were passed through and do the appropriate action. This answer may be useful: cs50.stackexchange.com/questions/1133/…, but be sure to check that the behaviour conforms to the specification for this problem set. Commented Aug 7, 2014 at 16:29
  • Thank you so much, it worked and it's all green! Commented Aug 7, 2014 at 17:26

You must log in to answer this question.

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