Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct bin{
- map<string, int> encryption;
- void set_up_code(){
- string alphabet[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
- int letter_num=1;
- for(int i = 0; i < 26; ++i){
- string letter = alphabet[i];
- encryption.insert(pair<string,int>(letter,letter_num));
- letter_num++;
- }
- }
- void encrypt(string& modify){
- int mod_array[modify.size()];
- for(unsigned int i = 0; i < modify.size(); ++i){
- stringstream ss;
- string letter;
- char c = modify[i];
- ss << c;
- ss >> letter;
- mod_array[i] = encryption[letter];
- }
- for(int x = 0;x < modify.size(); ++x){
- cout << mod_array[x];
- }
- }
- void decrypt(){
- //
- }
- }binary;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement