这是我到目前为止的代码:创建一个字符串数组并显示指数值来安慰
string[] animals = { "cow", "pig", "dog", "cat", "mouse", "giraffe", "moose", "deer", "lion", "hippo" };
Console.WriteLine("{0,5}{1,8}", "animal", "index");
Console.ReadLine();
这是我到目前为止的代码:创建一个字符串数组并显示指数值来安慰
string[] animals = { "cow", "pig", "dog", "cat", "mouse", "giraffe", "moose", "deer", "lion", "hippo" };
Console.WriteLine("{0,5}{1,8}", "animal", "index");
Console.ReadLine();
for(int i = 0; i < animals.length();i++) //Go through the whole array
{
Console.WriteLine(animals[i] + " " + i); //Output the animal and the index
}
Console.ReadLine(); //Wait for user input.
const int Array_length = 10; //创建一个命名常量 int [] array = new int [Array_length]; //创建一个新数组 //计算每个数组的值 (int counter = 0; counter
什么似乎没有工作呢? – bigcakes
我没有在这里看到的问题。 – paddy