I'm struggling to check50/submit50 for the caeser cipher wk2 pset for CS50. Can anyone please advise what mistake I'm making?

Code as linked: https://pastebin.com/5B7tcaGg

I'm attempting to use; check50 cs50/problems/2020/x/caesar

  • Are you sure you used that particular slug? Seems to work for me. – Blauelf Jan 29 '20 at 14:51
  • It might not pass the tests, though, since the checker expects "plaintext: " and "ciphertext: ". Also, you don't reject non-integer keys. – Blauelf Jan 29 '20 at 14:53
  • Solution: incorrect file name (my error) Seem to have fixed the check50/submit issue, however, I can't seem to get an int check for argv[2] working to reject alphas Any ideas where to start on a solution? I was trying if (argc != 2) || (isdigit(argv[2])), however it doesn't seem to work. – wf01 Jan 29 '20 at 16:47
  • Different question then. And valid index to argv is from 0 to argc-1. Also, cs50.harvard.edu/x/2020/psets/2/caesar/#validating-the-key (isdigit must be called for individual characters, not whole strings) – Blauelf Jan 29 '20 at 17:15

Your code prints an extra '.'(period) character along with the ciphered-character with each call made to printf function in order to print ciphered text. That is causing the check50 tests to fail.

Also, do the error checking for BAD KEY VALUES i.e., when the user inputs a floating-point number, a negative numeric value or a non-numeric value(e.g., a string) as KEY.

Including meaning full comments in your code is never a bad idea :)

You must log in to answer this question.

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