讀取這一行字符串,每一個字符串長度小於80個字符
對於每組數據,輸出每行字符串的加密字符串。
Ifmmp! Ipx bsf zpv!
代碼:
#include <iostream> #include<string> using namespace std; int main() { char str[100]; gets(str); for (int i = 0; str[i]!= '\0';i++) { if ((str[i] >= 'a'&&str[i]<'z') || (str[i] >= 'A'&&str[i]<'Z')) { str[i] = str[i] + 1; } else if (str[i] == 'z' ) { str[i] = 'a'; } else if (str[i] == 'Z') { str[i] = 'A'; } cout << str[i]; } system("pause"); return 0; }