Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5.  
  6. class cezar
  7. {
  8. int klucz;
  9. string dane;
  10. string szyfr;
  11.  
  12. public:
  13. cezar(string,int);
  14.  
  15. void szyfruj();
  16.  
  17. string zaszyfrowany();
  18.  
  19. };
  20. cezar::cezar(string dane1, int klucz1)
  21. {
  22. dane=dane1;
  23. klucz=klucz1;
  24.  
  25. }
  26.  
  27. void cezar::szyfruj(){
  28. for(int i=0;i<dane.length();i++){
  29.  
  30. szyfr+=dane[i]+klucz;
  31. }
  32. }
  33.  
  34. string cezar::zaszyfrowany(){
  35. return szyfr;
  36. }
  37.  
  38. int main(int argc, char** argv) {
  39.  
  40. cezar wyraz("xyz",2);
  41. wyraz.szyfruj();
  42. cout<<wyraz.zaszyfrowany();
  43.  
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement