Advertisement
Lichwiarz_Dusz

Szyfrator 2.1

Apr 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. void szyfrowanie(std::string & tekst)
  5. {
  6.     for (int a=0;a<tekst.size();a++)
  7.     {
  8.         if ((tekst[a]>64 && tekst[a]<88) || (tekst[a]>96 && tekst[a]<120))
  9.         {
  10.             tekst[a] +=3;
  11.         }
  12.         else
  13.         {
  14.             if ((tekst[a]>87 && tekst[a]<91) || (tekst[a]>118 && tekst[a]<123))
  15.             {
  16.                 tekst[a] -=23;
  17.             }
  18.         }
  19.     }
  20. }
  21.  
  22.  
  23. int main()
  24. {
  25.     std::string tekst;
  26.     std::cout << "Wpisz tekst do zaszyfrowania: ";
  27.     std::getline( std::cin, tekst);
  28.     szyfrowanie(tekst);
  29.     std::cout << "Zaszyfrowany tekst: " << tekst;
  30.     return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement