Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. #include <fstream>
  5.  
  6.  
  7. using namespace std;
  8. int main ()
  9. {
  10. {
  11. int s,i;
  12. ofstream g;
  13. string veta,sifra;
  14.  
  15. cout << "zadaj text: ";
  16. cin>>veta; cin.get();
  17. cin >> s ;cin.get();
  18. cout << "Text : " << veta;
  19. cout << "zmena: " << s;
  20. cout << "sifra " << sifra(veta, s);
  21.  
  22.  
  23. }
  24. string sifra(string veta, int s);
  25. {
  26. string result = "";
  27. for (int i=0;i<veta.length();i++)
  28. {
  29. result += char(int(veta[i]+s));
  30. }
  31. return result;
  32. }
  33.  
  34.  
  35.  
  36.  
  37. g.open("cezarova.txt",ios::app);
  38.  
  39. cout << veta <<endl;
  40. cout << sifra<<endl;
  41.  
  42. g.close();
  43.  
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement