Advertisement
Andites

задание 6

Jul 5th, 2022
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. vector<string> st;
  9. string temp, temp2, temp3;
  10. ifstream in;
  11. in.open("D:\\c++\\Input.txt");
  12. while (!in.eof()) {
  13. in >> temp;
  14. st.push_back(temp);
  15. }
  16. for (int i = 0; i < st.size(); i++) {
  17. temp2 = st[i];
  18. for (int j = 0; j < temp2.size(); j++) {
  19. temp2[j] = temp2[j] + 3;
  20. }
  21. st[i] = temp2;
  22. }
  23. cout << "Encrypted message: ";
  24. for (int i = 0; i < st.size(); i++) {
  25. cout << st[i] << " ";
  26. }
  27. cout << "\nDecrypted message: ";
  28. for (int i = 0; i < st.size(); i++) {
  29. temp2 = st[i];
  30. for (int j = 0; j < temp2.size(); j++) {
  31. temp2[j] = temp2[j] - 3;
  32. }
  33. st[i] = temp2;
  34. }
  35. for (int i = 0; i < st.size(); i++) {
  36. cout << st[i] << " ";
  37. }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement