Timeline for C: Vigenere code terminates before enciphering
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 18, 2017 at 10:41 | comment | added | Android1 | That's what I had originally. It compiles but it doesn't pass check50 checks because it doesn't check the whole length of the keyword at argv. When I run the checks I then get the Hax0r2 error which says it is supposed to exit because there are numbers in the key. I just also tried adding another 'if' statement underneath to iterate through argv after declaring it a key to check if each character isalpha before returning 1 but it rejected that too. Very frustrating. :-{ That one also compiled but failed check50. | |
Mar 18, 2017 at 10:40 | comment | added | Steve Bunting |
You are checking whether the length of argv[1] (a number) is alphabetic rather than whether argv[1] (a string) is alphabetic. In order to do this in C, you have to loop over each char in argv[1] and use the function isalpha() on each one.
|
|
Mar 18, 2017 at 9:02 | vote | accept | Android1 | ||
Mar 18, 2017 at 9:02 | comment | added | Android1 | It won't compile if the 1 is removed or replaced with anything else. If I leave the [] empty or remove them it throws an error when I try to compile. When I run check50 it checks if argv is alpha. That particular check works when the code is as it is there, otherwise that throws an error on check50. If I replaced the 1 with an i it threw an undeclared identifier error. Not sure how else to approach that. | |
Mar 18, 2017 at 6:34 | history | answered | Steve Bunting | CC BY-SA 3.0 |