Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <stdlib.h>
  4. using namespace std;
  5.  
  6. string ssl(string wort, char table[][26])
  7. {
  8. int i, j, n;
  9. char current;
  10. n = wort.length();
  11. std::string wort2=wort;
  12. for (i = 0; i < n; i++)
  13. {
  14. for (j = 0; j < 26; j++)
  15. {
  16. current = table[0][j];
  17. if (current == wort[i])
  18. {
  19. wort2[i] = table[1][j];
  20. }
  21. }
  22.  
  23. }
  24.  
  25. return wort2;
  26.  
  27. }
  28.  
  29.  
  30. int main()
  31. {
  32.  
  33. char feld[2][26] = { { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'O', 'P', 'R', 'S', 'T', 'U', 'W', 'X', 'Y', 'Z' },
  34. { 'R', 'S', 'T', 'U', 'W', 'X', 'Y', 'Z', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'O', 'P', 'A', 'B' } };
  35.  
  36. std::string crypt = "HACKER";
  37. std::string test;
  38. test = ssl(crypt, feld);
  39. std::cout << test << std::endl;
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement