Can someone please point me in the right direction to correct this code? i am getting blank results when entering a lowercase letter. Thanks!
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[])
{
if (argc ==1)
{
//say this if no arguments if entered//
printf("ENTER A KEY!!\n");
}
else {
string p = get_string();
//changes key to integer//
int key = atoi(argv[1]);
int cipher;
for (int i = 0; i<strlen(p); i++)
{
int chr = p[i];
if (isupper(chr))
{
cipher = ((chr-65+key) % 26)+65;
printf("%c", cipher);
}
else {
printf("%c", cipher = (chr+key) % 26);
}
}
return 0;
}
}