C#动态二维数组输出


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("请输入动态数组的行数:");
            int row = Convert.ToInt32(Console.ReadLine());
            Console.Write("请输入动态数组的列数:");
            int col = Convert.ToInt32(Console.ReadLine());
            int[,] arr = new int[row, col];
            Console.WriteLine("结果:");
            for(int i=0;i<row;i++)
            {
                for (int j=0;j<col;j++)
                {
                    Console.Write(i+j.ToString()+" ");//" "是空格
                }
                Console.ReadLine();
            }
                          
        }         
    }
}

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM