Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Laboration 3, Assignment_3.cpp
- // Fabian Tjernström (fatj1700) 2018-12-02
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- int main()
- {
- string decoded, coded;
- char manip;
- int y = 0;
- getline(cin, decoded);
- coded = decoded;
- while(y <= decoded.size()) {
- for(int i = 0; i <= 4; i++) {
- manip = coded[y];
- manip += 13;
- coded[y] = manip;
- y++;
- if(y % 5 == 0 && y % 10 != 0) {
- for(int u = 0; u <= 4; u++) {
- manip = coded[y];
- manip += 7;
- coded[y] = manip;
- y++;
- }
- }
- }
- }
- cout << coded << endl;
- decoded = coded;
- y = 0;
- while(y <= coded.size()) {
- for(int i = 0; i <= 4; i++) {
- manip = decoded[y];
- manip -= 13;
- decoded[y] = manip;
- y++;
- if(y % 5 == 0 && y % 10 != 0) {
- for(int u = 0; u <= 4; u++) {
- manip = decoded[y];
- manip -= 7;
- decoded[y] = manip;
- y++;
- }
- }
- }
- }
- cout << decoded << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement