My code seems to compile fine but when I try checkcs50, it says: :( handles non-numeric key timed out while waiting for program to exit, what do you think the problem is?
#include <stdio.h>
#include <ctype.h> #include <cs50.h> #include <string.h> #include <stdlib.h>
int main(int argc, string argv[]) {
string t = argv[1];
if (argc != 2 || isdigit(t[0]) ==0 )
{
printf("Usage: ./caesar key\n");
return 1;
}
int cle = atoi(argv[1]);
string m = get_string("Please enter plaintext here: ");
printf("ciphertext: ");
for (int i = 0, p = strlen(m) ; i < p; i++)
{
if (m[i] <= 'Z' && m[i] >= 'A')
{
printf("%c", (((m[i] - 'A') + cle) % 26) + 'A');
}
else if (m[1] <= 'z' && m[i] >= 'a')
{
printf("%c", (((m[i] - 'a') + cle) % 26) + 'a');
}
else
{
printf("%c", m[i]);
}
}
printf("\n");
return 0;
{
printf ("Usage: ./caesar key\n");
return 1;
}
}