Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct bin{
- void encrypt_vector(vector<string>& crypt){
- modify_string.clear();
- for(unsigned int i = 0; i < crypt.size(); ++i){
- string word = crypt[i];
- int mod_word[word.size()];
- for(unsigned int x = 0; x < word.size(); ++x){
- stringstream ssl;
- stringstream ssn;
- string letter;
- char let = word[x];
- ssl << let;
- ssl >> letter;
- int num = encryption[letter];
- mod_word[x] = num;
- }
- modify_string.insert(modify_string.end(), mod_word, mod_word + word.size());
- modify_string.push_back(.5);
- }
- }
- void decrypt_vector(vector<int>& uncrypt){
- string word;
- for(unsigned int i = 0; i < uncrypt.size(); ++i){
- int copy_iter = i;
- int number = uncrypt[i];
- for(it = encryption.begin(); it != encryption.end(); ++it){
- if(it->second == number){
- word.append(it->first);
- break;
- }
- }
- if(uncrypt[copy_iter++]==0){
- un_mod_vector.push_back(word);
- word.clear();
- continue;
- }
- }
- }
- }binary;
- binary.set_up_code();
- vector<string> thing;
- thing.push_back("apple");
- thing.push_back("pear");
- binary.encrypt_vector(thing);
- binary.decrypt_vector(binary.modify_string);
- for(vector<string>::iterator i = binary.un_mod_vector.begin();i!=binary.un_mod_vector.end();++i){
- cout << *i << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement