谁来解决下简单的字母加密转换怎么写
用C语言写一个段程序要求 随便输入几个字母 要求输出结果是这些字母是在原来字母上往后推五个字母 大写输出还是大写 小写输出还是小写 麻烦谁能写出来给看看谢谢了
// 简单的字符加密程序.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> #include <conio.h> #include <iomanip> #include <cstring> using std::cin; using std::cout; using std::endl; using std::setw; int _tmain(int argc, _TCHAR* argv[]) { const int MAX = 30; char key; int count = 0; char Str1[MAX]; char Str2[MAX]; for(int flag = 1;flag != 0;) { cout << "请输入密码:"; cin >> Str1; cout << "加密请输入Y/y,解密请输入N/n :"; cin >> key; if( key == 'y' || key == 'Y') { for(int T = 0;T <= strlen(Str1) - 1;T++) { if( T % 2 == 0 ) Str2[T] = Str1[T + 1]; else Str2[T] = Str1[T - 1]; } for( int i = strlen(Str1) - 1;i != -1;i--) { Str1[count] = Str2[i]; count += 1; } for(int i = 0;i <= strlen(Str1) - 1; i++) { if( Str1[i] == 'A' || Str1[i] == 'a') Str1[i] = Str1[i] + 3; else if( Str1[i] == 'Z' || Str1[i] == 'z') Str1[i] = Str1[i] - 3; else Str1[i] = Str1[i] + 1; } for(int T = 0;T <= strlen(Str1) - 1;T++) cout << Str1[T]; } else if( key == 'n' || key == 'N') { for(int i = 0;i <= strlen(Str1) - 1; i++) { if( Str1[i] == 'D' || Str1[i] == 'd') Str1[i] = Str1[i] - 3; else if( Str1[i] == 'W' || Str1[i] == 'w') Str1[i] = Str1[i] + 3; else Str1[i] = Str1[i] - 1; } for( int i = strlen(Str1) - 1;i != -1;i--) { Str2[count] = Str1[i]; count += 1; } for(int T = 0;T <= strlen(Str1) - 1;T++) { if( T % 2 == 0 ) Str1[T] = Str2[T + 1]; else Str1[T] = Str2[T - 1]; } for(int T = 0;T <= strlen(Str1) - 1;T++) cout << Str1[T]; } cout << endl << "继续请输入一个非0的值..." << endl; cin >> flag; cout << endl; count = 0; } cout << endl << "Press any key..."; _getch(); return 0; }以前写的....你试下...