}
foreach(int num in number)
{
console.writeline(num.tostring());
}
}
}
这段程序相信大家都看得懂吧(如果看不懂的话最好就别往下看了)。在这段程序中我们看到了c#如何定义一个数组,这和我们以前在c/c++使用的方法不太相同。c#使用了如下两句,来定义一个数组:
int [] number;
number = new int [6];
而在c/c++中使用一句
int number[6];