Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <windows.h>
- #define N 30
- int main()
- {
- int i, j;
- char word[N];
- int shift;
- char alphabet[] = {'A', 'Ą', 'B', 'C', 'Ć', 'D',
- 'E', 'Ę', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
- 'Ł', 'M', 'N', 'Ń', 'O', 'Ó', 'P', 'R', 'S',
- 'Ś', 'T', 'U', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż'
- }; //33 znaki
- system("CHCP 1250 >NUL");
- printf("Wyraz: ");
- scanf("%s", word);
- printf("Przesuniecie: ");
- scanf("%d", &shift);
- for(i=0; i<strlen(word); i++)
- {
- for(j=0; j<33; j++){
- if(word[i] == alphabet[j])
- word[i] = alphabet[j]+shift;
- }
- }
- printf("Zaszyfrowany wyraz: %s", word);
- /*
- for(i=0;i<33;i++)
- printf("%c\n", alphabet[i]);
- */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement