Facebook
From Diminutive Porcupine, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 213
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. string szyfruj (string tekst)
  8. {
  9.  
  10.     string wynik;
  11.  
  12.     int dl=tekst.size();
  13.     for(int i=0;i<dl;i+=4) wynik+=tekst[i];
  14.     for(int i=1;i<dl;i+=2) wynik+=tekst[i];
  15.     for(int i=2;i<dl;i+=4) wynik+=tekst[i];    
  16.  return wynik;
  17. }
  18. int main(int argc, char *argv[])
  19. {
  20. string tekst;
  21. cout<<"Wprowadz tekst do zaszyfrowania: "<<endl;
  22. cin>>tekst;
  23. cout<<"Slowo zaszyfrowane: "<<endl;
  24. cout<<szyfruj(tekst)<<endl;
  25.  
  26.    
  27.     return 0;
  28. }
  29.