Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- char sz[59]="SONY Pictures";
- void encryption(char *p);
- void de_cryption(char *p);
- int n = 12; // Ключ шифрования
- //////////////////////////////////////////////////
- int main()
- {
- encryption(sz);
- printf("%s \n", sz);
- de_cryption(sz);
- printf("%s \n", sz);
- }
- //////////////////////////////////////////////////
- void de_cryption(char *p) // = Y
- {
- int nLen = strlen(p);
- for(int i = 0; i < nLen; i++)
- {
- p[i] = p[i] - n;
- }
- }
- //////////////////////////////////////////////////
- void encryption(char *p) // = Y
- {
- int nLen = strlen(p);
- for(int i = 0; i < nLen; i++)
- {
- p[i] = p[i] + n;
- }
- }
- // printf("%c \n", sz[2]);
- /*
- #include<stdio.h>
- char sz[5]="SONY";
- //////////////////////////////////////////////////
- void foo(char *p) // = Y
- {
- char *p1 = p-1; // = N
- char c = *p; // = Y
- *p = *p1;
- *p1 = c;
- }
- //////////////////////////////////////////////////
- int main()
- {
- char *p = &sz[3];
- foo(p);
- printf("%s \n",sz);
- }
- */
- /*
- #include<stdio.h>
- char sz[5]="SONY";
- //////////////////////////////////////////////////
- void foo(char *p)
- {
- char c = *p;
- *p = *(p-1);
- *(p-1) = c;
- }
- //////////////////////////////////////////////////
- int main()
- {
- char *p=&sz[3];
- foo(p);
- printf("%s \n",sz);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement