
| 001 | // 從標準程式庫中引入 string |
| 002 | #include <string> |
| 003 | // 使用 std 中的 string 名稱 |
| 004 | using std::string; |
| 005 | |
| 006 | // 定義兩個巨集常數 |
| 007 | #define DIFF 97 |
| 008 | #define N 26 |
| 009 | |
| 010 | // 宣告 Encrypt 類別 |
| 011 | class Encrypt { |
| 012 | public: |
| 013 | // 宣告建構函數 |
| 014 | Encrypt(); |
| 015 | // 宣告 setter 與 getter 成員函數 |
| 016 | void set_code_array(); |
| 017 | void set_code_array(string); |
| 018 | string get_code_array(); |
| 019 | // 宣告編碼、解碼的成員函數 |
| 020 | string ToEncode(string); |
| 021 | string ToDecode(string); |
| 022 | |
| 023 | private: |
| 024 | // 密碼表字串 |
| 025 | string code_array; |
| 026 | }; |
| 027 | |
| 028 | /* encrypt.h |
| 029 | Kaiching Chang |
| 030 | 2014-5 */ |
the end
沒有留言:
張貼留言