Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main() {
- char str[20];
- char str2[20];
- int idx1 = 0; // index for str array
- int idx2 = 0; // index for str2 array
- // read the input
- cin.getline(str, 20); // <--- Vuvedi mu "I am a string"
- int str_len = strlen(str);
- int M = 4;
- int L = 3;
- idx2 = 3; // Tova trqbva da si go izchislish tochno kolko trqbva da e
- for (int i = 0; i < str_len; i++) {
- if (idx2 == str_len) {
- idx2 = 0;
- }
- str2[idx2] = str[i];
- idx2++;
- }
- for (int i = 0; i < str_len; i++) {
- cout << (char) (str2[i] + M);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement