using System;
using System.Text;
public class SimpleColumnarTransposition
{
public static int rownumber(ref string Array,ref int Line)//判断数组的行数
{
int leavenumber=Array.Length%Line;
int row1=(int)(Array.Length/Line);
if (leavenumber==0)
{
return (row1-1);
}
else
{
return (row1);
}
}
public static void getchar(int ROW,string mingwen,int Line)
{
int count=0;//记是args的第几个字符
char[][] ch=new char [ROW][];
for (int row2=0;row2<=ROW;row2++)
{
for (int i=0,number=count;i<Line;i++,number++,count++)
{
while (count<mingwen.Length)
{
ch[row2][i]=mingwen[number];
Console.Write(ch[row2][i]);
}
}
}
}
public static void Main()
{
int row,line;//row是行数,line是列数,number是字符在键盘输入经处理后字符在字符串中的位置
string arg;
Console.WriteLine("输入你想输入的明文:");
arg=Console.ReadLine();
string args=arg.Replace(" ","");
Console.WriteLine("输入一个数字定义是几列的数组:");
line=Convert.ToInt32(Console.ReadLine());
row=rownumber(ref args,ref line);
char[][] cha=getchar(row,args,line);/////////////这行出错了。。。。。。。。。。。。。。。。。。。。。。
Console.WriteLine("Press the key number:");
string s=Console.ReadLine();
foreach(char number1 in s)
{
int number2=(int)number1;
for (int x=0;x<=row;x++)
{
Console.WriteLine(cha[x][number2]);
}
}
}
}