我试图了解我为 caesar.c 编程所做的工作,但仍不清楚。至少我想添加 isupper 和 islower 等等?
#include<stdio.h>
#include<cs50.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
int main (int argc, string argv[])
{
int k;
k = atoi(argv[1]);
if(k <=0)
{
printf("You must input a non-negative integer.\n");
return 1;
}
printf("What do you want to cipher?\n");
string cipherInput = GetString();
if(isalpha(cipherInput))
{
for (int i =0, n = strlen(cipherInput); i < n; i++)
{
printf("%c", (cipherInput[i] + k % 26));
}
}
else
{
printf("%s\n", cipherInput);
}
printf("\n");
}
我想在编译后有一个结果一定要喝你的阿华田!
即使是 rot 13 也很难理解,但我还没有任何结果。
请给我任何建议。
先感谢您。