#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int main (int argc, string argv[])
{
if (argc != 2)
{
printf("Usage /caesar.c <key> ");
return 1;
}
int key,e;
key = atoi(argv[1]);
string pt;
pt = GetString();
string et;
et = pt;
for (int i=0; pt[i] != '\0'; i++)
{
if(isalpha(pt[i]))
{
if (islower(pt[i]))
{
e = (((pt[i] - 96) + key)% 26) + 96;
et[i] = (char)e;
}
if (isupper(pt[i]))
{
e = (((pt[i] - 64) + key)% 26) + 64;
et[i] = (char)e;
}
}
}
printf("%s", et);
return 0;
}
The output is the same as asked by the program but still shows an error on checking.