Advertisement
fabbe680

3.3

Jan 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. // Laboration 3, Assignment_3.cpp
  2. // Fabian Tjernström (fatj1700) 2018-12-02
  3.  
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <string>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. string decoded, coded;
  13. char manip;
  14. int y = 0;
  15.  
  16. getline(cin, decoded);
  17.  
  18. coded = decoded;
  19.  
  20. while(y <= decoded.size()) {
  21. for(int i = 0; i <= 4; i++) {
  22. manip = coded[y];
  23. manip += 13;
  24. coded[y] = manip;
  25. y++;
  26. if(y % 5 == 0 && y % 10 != 0) {
  27. for(int u = 0; u <= 4; u++) {
  28. manip = coded[y];
  29. manip += 7;
  30. coded[y] = manip;
  31. y++;
  32. }
  33. }
  34. }
  35. }
  36.  
  37. cout << coded << endl;
  38.  
  39. decoded = coded;
  40. y = 0;
  41.  
  42. while(y <= coded.size()) {
  43. for(int i = 0; i <= 4; i++) {
  44. manip = decoded[y];
  45. manip -= 13;
  46. decoded[y] = manip;
  47. y++;
  48. if(y % 5 == 0 && y % 10 != 0) {
  49. for(int u = 0; u <= 4; u++) {
  50. manip = decoded[y];
  51. manip -= 7;
  52. decoded[y] = manip;
  53. y++;
  54. }
  55. }
  56. }
  57. }
  58.  
  59. cout << decoded << endl;
  60.  
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement