我无法使用矩阵容器打印名称,是否可以使用矩阵打印名称?

时间:2019-04-28 17:22:38

标签: c# matrix

public void PrintNames() 
{
    string[,] matrix = new string[3, 3]; 
    Console.WriteLine("write a name:");
    string a = Console.ReadLine(); 
    Console.WriteLine("write a name:");
    string b = Console.ReadLine();

    for (int i = 0; i < 3; i++)
    {
        for (int x  = 0; x < 3; x++)
        {
            Console.Write("{0} row {1} component {2} name", i +1,x+1, matrix[i, x]);
            Console.WriteLine();
        }
    }
}

我是一位真正的初学者程序员,我想完成我的作业。 我的问题是我无法打印在控制台中写的名称。例如:请写一个名字:Jhon Wick(输入) 请输入名称:Kyle(输入) 之后,我要打印:1.行1.组件Jhon Wick   1.行2.组件Kyle

0 个答案:

没有答案