第八周專案四 字串加密

2021-08-14 04:58:08 字數 846 閱讀 3839

【專案四 - 字串加密】

問題描述:乙個文字串可用事先編制好的字元對映表進行加密。例如,設字元對映表為: 

abcdefghijklmnopqrstuvwxyz 

ngzqtcobmuhelkpdawxfyivrsj 

則字串「lao he jiao shu ju jie gou」被加密為「enp bt umnp xby uy umt opy」。  

設計乙個程式,實現加密、解密演算法,將輸入的文字進行加密後輸出,然後進行解密並輸出。 

輸入描述:無 

程式輸出:測試資料

程式及**:

#include #include using namespace std;

#include #define maxsize 100 //最多的字元個數

typedef struct

sqstring;

sqstring a,b; //用於儲存字元對映表

void strassign(sqstring &s,char cstr) 字串常量cstr賦給串s

void dispstr(sqstring s) //輸出串

q.length=p.length;

return q;

}sqstring unencrypt(sqstring q)

p.length=q.length;

return p;

}int main()

執行結果:

第八周專案四 字串加密

all rights reservrd.版本號 v1.0 問題描述 設計乙個程式,實現加密 解密演算法,將輸入的文字進行加密後輸出,然後進行解密並輸出。問題輸入 ni hao ma wo hen hao 問題輸出 km bnp ln vp btk bnp sqstring.h ifndef sqst...

第八周 專案4 字串加密

檔名稱 main.cpp 作者 王超 完成日期 2015年10月23日 問題描述 字串加密 include include sqstring.h sqstring a,b 用於儲存字元對映表 sqstring encrypt sqstring p q.length p.length return q...

第八周專案4 字串加密

檔名稱 h1.cpp 完成日期 2015年10月26日 版本號 vc6.0 問題描述 設計乙個程式,實現加密 解密演算法,將輸入的文字進行加密後輸出,然後進行解密並輸出。輸入描述 加密檔案 程式輸出 加密 解密的結果 include include define maxsize 100 最多的字元個...