📄 encryption.cpp
字号:
// Chapter 5 of C++ How to Program
// Exercise2.cpp
// 加密解密,方法:对字符串中的每个字符按字符加上同样的整数值(例如5)
//变成ASCII码表中其它字符形成新的字符串,解密时减去相同的进行恢复。
#include <iostream>
using std::cout;
using std::endl;
/* Write the prototype for function encrypt(加密) */
/* Write the prototype for function decrypt (解密)*/
int main()
{
// create a string to encrypt
//把这里的字符数组改成字符指针,会出现什么情况,解释原因。
char string[] = "this is a secret!";
cout << "Original string is: " << string << endl;
encrypt( string );
cout << "Encrypted string is: " << string << endl;
decrypt( string );
cout << "Decrypted string is: " << string << endl;
system("PAUSE");
return 0;
} // end main
// encrypt data
void encrypt( char e[] )
{
/* Write implementation(实现) for function encrypt */
} // end function encrypt
// decrypt data
void decrypt( char *ePtr )
{
/* Write implementation for function decrypt */
} // end function decrypt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -