Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <string.h>
- #include <locale.h>
- void codeText(char cryptogram[255])
- {
- char base[57] = "MY_DOG_SECURITY_WARM_SOURCE_CODE_UGLY_FLOWER_GOOD_NIGHT_\0";
- char codeWord[50], baseWord[50];
- char temp;
- int i = 0, k;
- int j = 0, underscoreCount;
- while (cryptogram[i] != '\0')
- {
- k = 0;
- while (cryptogram[i] != '_')
- {
- codeWord[k] = cryptogram[i];
- k++;
- i++;
- }
- codeWord[k] = '\0';
- underscoreCount = 0;
- k = 0;
- underscoreCount = 0;
- while (underscoreCount != 2)
- {
- if (base[j] == '_')
- underscoreCount++;
- baseWord[k] = base[j];
- k++;
- j++;
- }
- baseWord[k] = '\0';
- printf("%s%s_", baseWord, codeWord);
- i++;
- }
- }
- void main()
- {
- setlocale(LC_ALL, "Rus");
- printf("Введите предложения для шифровки (допустимые символы - прописные латинсике буквы и знаки нижнего подчёркивания, количество слов в пердложении - до 5):\n");
- char str[255];
- scanf("%s", str);
- codeText(str);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement