Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "russian");
- const int m = 5;
- const int n = 5;
- int i, j, size, l,i1,j1;
- int check;
- string message;
- cout << "Enter your message" << endl;
- getline(cin, message);
- size = message.size();
- cout << "text lenght = " << size << endl;
- char A[m][n] = { { 'A', 'B', 'C', 'D', 'E'},
- { 'F', 'G', 'H', 'I', 'K'},
- { 'L', 'M', 'N', 'O', 'P'},
- { 'Q', 'R', 'S', 'T', 'U'},
- { 'V', 'W', 'X', 'Y', 'Z'} };
- cout << "1 - crypt / 2 - decrypt" << endl;
- cin >> check;
- if (check == 1)
- {
- for (l = 0; l < size; l++)
- {
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- if (message[l] == A[i][j])
- {
- cout << i + 1 << j + 1 << ' ';
- }
- }
- }
- }
- cout << endl;
- }
- else
- {
- for (i = 0; i < size; i=i+2)
- {
- for ( j = 1; j < size; j=j+2)
- {
- i1 = message[i];
- j1=message[j] ;
- cout << A[i1][j1];
- }
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement