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()
- {
- SetConsoleCP(GetACP());
- SetConsoleOutputCP(GetACP());
- 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
- printf("Wyraz: ");
- scanf("%s", word);
- printf("Przesuniecie: ");
- scanf("%d", &shift);
- for(i=0; i<strlen(word); i++)
- {
- for(j=0; j<strlen(alphabet); j++){
- if(word[i]==alphabet[j]){
- word[i] = alphabet[ (j+shift) % (strlen(alphabet)-1) ];
- break;
- }
- }
- }
- printf("Zaszyfrowany wyraz: %s", word);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement