Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- char* crypt (char* word)
- {
- char values[] = "abcdefghijklmnopqrstuvwxyz";
- static char String[5];
- int i;
- int key = 3;
- for (i = 0; i < strlen(word); i++)
- {
- char find = word[i];
- const char *ptr = strchr(values, find);
- int index = ptr - values;
- String[i] = values[index+key];
- }
- return String;
- }
- int main(int argc, char *argv[])
- {
- char word[5]="abcd";
- char* result=crypt(word);
- printf("%s\n", result);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement