-
Notifications
You must be signed in to change notification settings - Fork 0
/
decoders.cs
33 lines (33 loc) · 899 Bytes
/
decoders.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
static void Skitala(string text)
{
for (int i = 2; i <= text.Length / 2 + (text.Length % 2 == 0 ? 0 : 1); i++)
{
int len = text.Length / i + (text.Length % i == 0 ? 0 : 1);
char[,] table = new char[i, len];
Console.WriteLine("Table {0} x {1}", i, len);
int str_pos = 0;
for (int j = 0; j < len; j++)
{
for (int k = 0; k < i; k++)
{
try
{
table[k, j] = text[str_pos];
}
catch(Exception ex)
{
table[k, j] = ' ';
}
str_pos++;
}
}
for(int j = 0; j < i; j++)
{
for (int k = 0; k < len; k++)
{
Console.Write("{0} | ", table[j, k]);
}
Console.Write("\n");
}
}
}