2

my code seems to work but check50 seems to disagree and has given me the following:

  • :( encrypts "a" as "b" using 1 as key expected "ciphertext: b\n", not "ciphertext: b\x..."
  • :( encrypts "barfoo" as "yxocll" using 23 as key expected "ciphertext: yxo...", not "ciphertext: yxo..."
  • :( encrypts "BARFOO" as "EDUIRR" using 3 as key expected "ciphertext: EDU...", not "ciphertext: EDU..."
  • :( encrypts "BaRFoo" as "FeVJss" using 4 as key expected "ciphertext: FeV...", not "ciphertext: FeV..."
  • :( encrypts "barfoo" as "onesbb" using 65 as key expected "ciphertext: one...", not "ciphertext: one..."
  • :( encrypts "world, say hello!" as "iadxp, emk tqxxa!" using 12 as key expected "ciphertext: iad...", not "ciphertext: iad..."

as far as I can tell, my programme seems to be working. Any ideas?

3

Double check your loop condition. Your output is showing that you are printing the null char that signifies the end of the string.

Be sure that if you have a string "ab" (which, in memory is 'a', 'b', '\0' that you don't try to print the '\0'). This what check50 is showing with that \x it is receiving.

1
  • Thank you so much. :D I made a mistake at my loop where <= should have only been a <
    – Grace
    Feb 9 '18 at 7:24
1

Are you using a line feed, \n, to terminate the output or something else? It seems as if you're outputting something else, based on expected "ciphertext: b\n", not "ciphertext: b\x..."

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • Thank you so much. :D I made a mistake at my loop where <= should have only been a < .
    – Grace
    Feb 9 '18 at 7:24

You must log in to answer this question.

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