Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.8 kB
4
Indexable
Never
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <string.h>
#include <vector>
using namespace std;
int main()
{
    string text_to_decode = "BTLLTU_EL_EOYPM_APJZLCYNDREOKYLI_ZMFO_AGJY_O_N_DEWFWGISYSII_LEI_",
           decode_code = "";

    int text_size = text_to_decode.size();
    int row_column_numbers = 0,
        multiply_numbers = 0,
        temp = 0;

    while(1)
    {
        temp = multiply_numbers * multiply_numbers;
        if(temp == text_size)
        {
            row_column_numbers = multiply_numbers;
            break;
        }
        multiply_numbers++;
    }
           
   char tab_to_convert[row_column_numbers][row_column_numbers];
   int pointer_to_string = 0;
   for(int row = 0; row < row_column_numbers; row++)
   {
       for(int column = 0; column < row_column_numbers; column++)
       {
           tab_to_convert[row][column] = text_to_decode[pointer_to_string];
           pointer_to_string++;
       }
   }
   
   for(int row = 0; row < row_column_numbers; row++)
   {
       for(int column = 0; column < row_column_numbers; column++)
       {
           cout << tab_to_convert[row][column];
       }
       cout<<endl;
   }
   cout << endl;
   for(int row = 0; row < row_column_numbers; row++)
   {
       for(int column = 0; column < row_column_numbers; column++)
       {
           cout << tab_to_convert[column][row];
       }
       cout<<endl;
   }
   return 0;
}
Leave a Comment