I've been attempting to submit my Caesar cipher solution to no avail; my first submit worked fine but then I noticed that my code was well full of bugs. So, I fixed it, and submitted again. Following that, a more cryptic bug, that I believe I've fixed, but whenever I use either check50 or submit50 it appears as if they're checking my 2nd iteration of code instead of my 3rd.

For example, my solution's last line of code is the final printf that reads:

printf("ciphertext: look at all this text not printing %s", cipher);

But when submitted to check50, and I follow the link to the verbose outputs, it reads:

checking for output "ciphertext: b\n"...

^^^ that "b" is expected and that extra "\n" is no longer there in my solution.^^^

I don't think this is a code problem, but I can provide my solution if that will assist anyone in assisting me.

I've attempted all of the obvious things; log out/in, shutdown the pc, clear cache session and cookies. Still not getting anywhere with this.

So, any ideas?

Thanks, Doug

#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(int argc, string argv[])
    for(int i = 0; i < strlen(argv[1]); i++)
        if(argv[1][i] > 57)
            printf("Usage: ./caesar key\n");
            return 1;
    char *plain;
        plain = get_string("plaintext: ");
    while(strlen(plain) < 1);
    char cipher[100];
    char cipherChar[100];
    for(int i = 0, temp = 0, arg = atoi(argv[1]); i < strlen(plain); i++)
                temp = (((plain[i] - 65) + arg) % 26) + 65;
                temp = (((plain[i] - 97) + arg) % 26) + 97;
        sprintf(cipherChar, "%c", temp);
        strcat(cipher, cipherChar);
//     cipher[strlen(cipher)] = '\0';
    printf("ciphertext: %s", cipher);
  • Are you running check50/submit50 from the same directory that contains the current source code? And does the source code file have the correct file name?
    – Cliff B
    Oct 4 '19 at 1:57
  • I believe I am: /root/sandbox/caesar.c I haven't created a new directory nor any additional files for this project. As for the submission, I've been copy/pasting the check50 command: check50 cs50/problems/2019/x/caesar Oct 5 '19 at 1:35
  • If you're printing ANYTHING other than what is called out in the spec, like "look at all this text not printing" , that will cause a fail. Even capitalizing a letter that shouldn't be uppercase will cause a fail. I should have seen this when I read it earlier. If this isn't it, please run check50 and post a screenshot of the IDE with the result, along with ls -al results.
    – Cliff B
    Oct 5 '19 at 3:49
  • I expect it to fail. But, that printf statement is also not showing up in the post check50 summary; the link provided after each run: submit.cs50.io/check50/7212441582b33e9eccd44e4fa183e8f168cc4b2b Oct 5 '19 at 5:14
  • As for screenshots: photos.app.goo.gl/hr2AKeXiVWtMFpCm7 Oct 5 '19 at 5:20

You must log in to answer this question.

Browse other questions tagged .