I'm stuck at encrypting uppercase text. My code works fine for lowercase text, but will return wrong output when it comes to encrypting uppercase chars.
for (int c = 0; c < length_of_ptext; c++) {
if ((isupper(ptext[c])) && (islower(shift[c])))
ctext[c] = (((ptext[c] - 'A') + (shift[c] - 'A')) % 26) + 'A';//encryption of uppercase characters with lowercase key
else if ((islower(ptext[c])) && (islower(shift[c])))
ctext[c] = (((ptext[c] - 'a') + (shift[c] - 'a')) % 26) + 'a';//encryption of lowercase characters with lowercase key
else
ctext[c] = shift[c];//non-alphabetical characters remain as they are
}