Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <ctype.h>
- #include <stdio.h>
- #define SIZE 80
- char *transform(char *str, int n, int i, int x) {
- if (i == n) {
- return str;
- }
- if (islower(str[i])) {
- str[i] = 'a' + (str[i] - 'a' + x) % 26;
- } else if (isupper(str[i])) {
- str[i] = 'A' + (str[i] - 'A' + x) % 26;
- }
- return transform(str, n, ++i, x);
- }
- int main() {
- int n, x, i;
- char str[SIZE];
- scanf("%d %d", &n, &x);
- for (i = 0; i < n; i++) {
- gets(str);
- printf("%s", transform(str, strlen(str), 0, x));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement