1

I finished my vigenere and it works good with all the parameters but when I go through check50 with BaZ keyword, check50 give this answer

jharvard@appliance (~/Dropbox/CS50/pset2): ./vigenere BaZ
BaRFoo
CaQGon
jharvard@appliance (~/Dropbox/CS50/pset2): check50 2014/x/pset2/vigenere vigenere.c
:) vigenere.c exists
:) vigenere.c compiles
:) encrypts "a" as "a" using "a" as keyword
:) encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword
:( encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword
\ expected output, but not "Ca\u0000QGo\u000en\n"
:) encrypts "BARFOO" as "CAQGON" using "BAZ" as keyword
:) handles lack of argv[1]
:) handles argc > 2
:) rejects "Hax0r2" as keyword
https://sandbox.cs50.net/checks/da3280c78bdd4dd99b1a3953284dfba8

I hope you guys can give some word of advice, Thanks a lot.

Regards!

3
  • 1
    Looks like there's something wrong with your ciphering formula. – Kareem Aug 25 '14 at 9:31
  • 2
    The \u0000 means that there is a unicode character being inserted after the a and o. Check that the function is appending characters, and not strings. – Luke Van In Aug 25 '14 at 18:31
  • I have the same problem with \u0000 . – user2573 Oct 3 '14 at 1:25
1

First you have to covert whole key to upper case then use it....

like here "BaZ" should convert in "BAZ"

5
  • Yes, thank you for this tip. This solved the problem I have been stuck on for some time. Why does it have to be converted though? – MrNiceGuy Mar 25 '15 at 19:16
  • how do you do that? – peter Jun 23 '15 at 18:22
  • I don't undserstand why the keyword has to be converted to upper case ..can some one please explain ... ? – Krishna priya Jun 27 '15 at 6:07
  • Yes can someone please elaborate on this – GettingTheHang-of-it Sep 6 '15 at 21:10
  • 2
    @GettingTheHang-of-it, you don't strictly have to convert the key to upper case, you just have to make sure that no matter whether the user inputs: baz, Baz, bAz, baZ, bAZ, BaZ, BAz, or BAZ that key is { 1, 0, 25}. There are a few ways to accomplish this; one of them is to convert the whole key to upper case. You could also put it all in lower case, or, just handle the case char by char. – Sam Gerber Sep 21 '15 at 5:43

You must log in to answer this question.

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