暗号は islower 部分では機能しますが、isupper 部分では機能しません。たとえば、キー 3 をI like pie!!指定して暗号化を入力すると、O olnh slh!!私も試しHELLOてみてNKRRU. isupper 部分は、文字だけでなく句読点も返します。また、元のメッセージが暗号メッセージと一致するように変更されている理由もわかりません。
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int main (int argc, string argv[])
{
    /*
    Get key from user at command line
    Get plaintext from user
    Use key to encipher text: c[i] = (p[i] + k)%26
    Print ciphered message
    */        
    string message, cipher;
    int key;
    // command line, if user doesn't enter 2 arguments return 1 and request a valid 
    //encryption key and rerun.
    if (argc != 2)
        {
        printf("Please enter a valid encryption key and rerun program.\n");
        return 1;
        }
    else
        {
        key = atoi(argv[1]);
        }
    printf("Enter the message you wish to encrypt.\n");
    message = GetString();
    cipher = message;
    int length = strlen(message);
    for ( int i = 0; i < length; i++)
        {
        if (isalpha(message[i]))
            {
            if (isupper(message[i]))
                {
                cipher[i] = (message[i] - 'A' + key) % 26 + 'A';
                }
            else (islower(message[i]));
                {
                cipher[i] = (message[i] - 'a' + key) % 26 + 'a';
                }
            }
        else continue; //message[i] contains punctuation or a space
        } 
         printf("Your original message was..\n");
         printf("%s\n", message);
         printf("The encrypted message is...\n");
         printf("%s\n", cipher);         
         return 0;            
}