0

Here is a part of my caesar code. I used Check50 to check it, but got a bunch of results saying that it expected an input, not an output for the answer. However, when I manually typed in the answers, all of the answers worked.

thx in advance

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

int main(int argc, string argv[])
{

int Input = atoi(argv[1]);
int NewNumber;

{

    printf ("Type in your text here: ");
    string text = GetString();


    for (int i = 0, length = strlen(text); i < length; i++)
    {
        char Letter = text[i];


        if (isupper(Letter))
        {
        int Convert = (int)Letter - 65;

        NewNumber = Convert + Input;
        NewNumber = NewNumber%26 + 65;
        }

        else if (islower(Letter))
        {
        int Convert = (int)Letter - 97;

        NewNumber = Convert + Input;
        NewNumber = NewNumber%26 + 97;
        }

        else
        {
        NewNumber = (int)Letter;
        }


        char NewText = (char)NewNumber;
        printf ("%c", NewText);

    }


        printf ("\n");
        return 0;

}
}
0

It is a little hard to figure out what needs to be fixed without having posted the exact errors from check50, but I can see a couple of issues that you should be able to resolve on your own by testing out the staff implementation of Caesar: ~cs50/pset2/caesar

Your program must behave exactly as the staff's implementation, down to the character.

Good luck.

2
  • I tested out the words, and they worked exactly as cs50's own implementation. I did say that I was didn't post the complete code... if you didn't see. – BooFluff May 23 '15 at 0:07
  • 1
    nvmd, I just had to remove the prompt. thx – BooFluff May 23 '15 at 0:17

You must log in to answer this question.

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