Advertisement
Baxram97

Untitled

Mar 15th, 2022
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. string encrypt(const std::string &word) {
  9.     string res;
  10.     res.reserve(word.size());
  11.  
  12.     for (int i = 0; i < word.size(); i++) {
  13.         res.push_back(~word[i]);
  14.     }
  15.  
  16.     return res;
  17. }
  18.  
  19.  
  20. void put(const char *name, const std::vector<const char *> &vec) {
  21.     std::ofstream file{name, std::ios::out | std::ios::binary};
  22.  
  23.     if (!file.is_open()) {
  24.         std::cerr << "File is not open! " << std::endl;
  25.     } else {
  26.         for (auto &i: vec) {
  27.             file << encrypt(i) << std::endl;
  28.  
  29.         }
  30.     }
  31. }
  32.  
  33. int main() {
  34.  
  35.     string path = "Word";
  36.     put("Word",
  37.         {"Tron", "Shusha", "Zamanov", "Moquda", "boss", "main", "Scooby", "void", "Shamakhi", "Kiev", "Baku", "Leon",
  38.          "step", "root", "Suleyman", "Baku", "Maide"});
  39.  
  40.     return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement