主题:新手求救
using System;
namespace array
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
int[] arr = new int[5];
for (int i = 0; i < arr.Length; i++)
arr[i] = i;
for(int i=0;i<arr.Length;i++)
Console.WriteLine("Arr[{0}]={1}",i,arr[i]);
int[] arr1=new int[3] {
1,2,3};
for (int i = 0; i < arr1.Length; i++)
Console.WriteLine("Arr1[{0}]={1}", i, arr1[i]);
int[,] arr2 = new int[,] { { 1, 2, 3 }, { 4, 5, 6 } };
for(int i=0;i<=1;i++)
for(int j=0;j<=2;j++)
Console.WriteLine("arr2[{0}][{1}]={2}",i,j,arr2[i,j]);
string[][] Novelists=new string[3][];
Novelists[0]=new string []{"fyodor","mikljalfjdal","aslfjewqp"};
Novelists[1]=new string []{"jaoie","cipejide","iwhoxaslfjewqp"};
Novelists[2]=new string []{"iemcurdor","miasdfakljalfjdal","lwekrj"};
for (int i=0;i<Novelists.GetLength(0);i++)
for (int j=0;j<Novelists[1].GetLength(0);j++)
Console.WriteLine("Novelist[{0}][{1}]={2}",i,j,Novelists[i][j]);
}
}
}
请问 string[][] Novelists=new string[3][];
Novelists[0]=new string []{"fyodor","mikljalfjdal","aslfjewqp"};
Novelists[1]=new string []{"jaoie","cipejide","iwhoxaslfjewqp"};
Novelists[2]=new string []{"iemcurdor","miasdfakljalfjdal","lwekrj"};
for (int i=0;i<Novelists.GetLength(0);i++)
for (int j=0;j<Novelists[1].GetLength(0);j++)
Console.WriteLine("Novelist[{0}][{1}]={2}",i,j,Novelists[i][j]);
这几句是什么意思..初学C#..麻烦解一下,,小弟先谢谢大家了
namespace array
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
int[] arr = new int[5];
for (int i = 0; i < arr.Length; i++)
arr[i] = i;
for(int i=0;i<arr.Length;i++)
Console.WriteLine("Arr[{0}]={1}",i,arr[i]);
int[] arr1=new int[3] {
1,2,3};
for (int i = 0; i < arr1.Length; i++)
Console.WriteLine("Arr1[{0}]={1}", i, arr1[i]);
int[,] arr2 = new int[,] { { 1, 2, 3 }, { 4, 5, 6 } };
for(int i=0;i<=1;i++)
for(int j=0;j<=2;j++)
Console.WriteLine("arr2[{0}][{1}]={2}",i,j,arr2[i,j]);
string[][] Novelists=new string[3][];
Novelists[0]=new string []{"fyodor","mikljalfjdal","aslfjewqp"};
Novelists[1]=new string []{"jaoie","cipejide","iwhoxaslfjewqp"};
Novelists[2]=new string []{"iemcurdor","miasdfakljalfjdal","lwekrj"};
for (int i=0;i<Novelists.GetLength(0);i++)
for (int j=0;j<Novelists[1].GetLength(0);j++)
Console.WriteLine("Novelist[{0}][{1}]={2}",i,j,Novelists[i][j]);
}
}
}
请问 string[][] Novelists=new string[3][];
Novelists[0]=new string []{"fyodor","mikljalfjdal","aslfjewqp"};
Novelists[1]=new string []{"jaoie","cipejide","iwhoxaslfjewqp"};
Novelists[2]=new string []{"iemcurdor","miasdfakljalfjdal","lwekrj"};
for (int i=0;i<Novelists.GetLength(0);i++)
for (int j=0;j<Novelists[1].GetLength(0);j++)
Console.WriteLine("Novelist[{0}][{1}]={2}",i,j,Novelists[i][j]);
这几句是什么意思..初学C#..麻烦解一下,,小弟先谢谢大家了