#include <stdio.h> int main() { // 凯撒加密,明文中字母按字母表左移或者右移三位,这里右移 char input[6] = "hello"; char output[6]; int key = 3; int i,j; for (i = 0; i < 5; i++) { int a = input[i]; a += 3; output[i] = (char)a; } output[i] = ' '; printf("加密后:%s ", output); for (j = 0; j < 5; j++) { int b = output[j]; b -= 3; input[j] = (char)b; } input[j] = ' '; printf("解密后:%s", input); return 0; }