#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int main(int argc, string argv[])
{
if (argc != 2)
return 1;
else
{
string s = GetString();
printf("\n");
int k = atoi(argv[1]);
for (int i = 0, n = strlen(s); i < n; i++)
{
if (isalpha(s[i]))
{
if (isupper(s[i]))
{
int a = 's[i]' - 65;
int asciii = (a + k) % 26;
int asciiii = asciii + 65;
printf("%c", asciiii);
}
else
{
int a = 's[i]' - 97;
int asciii = (a + k) % 26;
int asciiii = asciii + 97;
printf("%c", asciiii);
}
}
else
{
printf("%c", s[i]);
}
}
printf("\n");
}
}
for example, if I input ./caesar 5 and specify the string to be for example "fds", the output will be as follow: vvv
I ve already spent about 2 and half hours with this and still didnt manage to come up with a solution.