using System;
namespace lesson3_二维数组练习题
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("二维数组练习题");
#region 练习题1
//将1到10000赋值给一个二 维数组(100行100列)
/*int[,] a = new int[100, 100];
int x = 1;
for (int i = 0; i < a.GetLength(0); i++)
{
for (int j = 0; j < a.GetLength(1); j++)
{
a[i, j] = x++;
}
}
Console.WriteLine(a[5,0]);*/
#endregion
#region 练习题2
//将二维数组(4行4列)的右上半部分置零(元索随机1~100)
/* int[,] b = new int[4, 4];
for (int i = 0; i < b.GetLength(0); i++)
{
for (int j = 0; j < b.GetLength(1); j++)
{
Random rd = new Random();
int sjs = rd.Next(1, 100);
b[i,j] = sjs;
Console.Write(" " + b[
二维数组-练习题
最新推荐文章于 2024-04-16 22:49:32 发布