0

On my end my code seems to output exactly what check50 wants, yet it says that ive outputted nothing. e.g :( encrypts "A" as "Z" using ZYXWVUTSRQPONMLKJIHGFEDCBA as key Cause expected "ciphertext: Z...", not "" . When i do this i get Z exactly as it wants?? Ive tried putting print "ciphertext" as the very first line of code then doing check50 and it still says i have no output.

[removed code from public view per academic honesty guidelines]

Any help would be appreciated :)

3
  • When I ran check50 on that, it passed the test you mentioned but failed others. Are you certain you are showing us the same version that you are checking?
    – curiouskiwi
    Apr 6, 2022 at 1:41
  • I was able to duplicate his result.
    – Cliff B
    Apr 6, 2022 at 4:09
  • Anyone has a solution to this? I've got the same problem. Jul 12, 2022 at 3:13

2 Answers 2

2

Following on to Cliff's answer,

if (argv[i] == argv[k])

You cannot access anything beyond argv[1] because you've already tested that argc is 2, so there are only argv[0] and argv[1].

Your loop is trying to access argv[10] for example.

You are accessing memory beyond the program, and check50 is crashing.

Perhaps you meant to look at argv[1][i] ?

1

I can't explain the "no output" errors in your check50 result, and I'm talking to @curiouskiwi about that, but your code still has a separate problem.

If you remove the parameter checking code at the beginning, the problem will show up in check50. In short, once this code encodes a letter as lower case, every time that letter encodes again, it will still be lower case. It won't encode to UPPER case. It's the right encoded letter, but the wrong case. For instance, if the plaintext is AaA, and a encodes to z, the code will generate Zzz when it should be ZzZ. Should be easy to fix.

We're still looking at the other issue. ;-)

You must log in to answer this question.

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