首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

关于数组的有关问题

2012-02-21 
关于数组的问题有0到100这样一个整数数组      返回该数组中的最大值完整的代码怎么写,请教下[解决办法]这

关于数组的问题
有0到100这样一个整数数组
      返回该数组中的最大值
完整的代码怎么写,请教下

[解决办法]
这个算不算:
int[] array = new int[100];
Random ran = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < array.Length; i++)
{
array[i] = ran.Next(0, 100);
}

int max = 0;
for (int i = 0; i < array.Length; i++)
{
if (array[i] > max)
{
max = array[i];
}
}
Console.WriteLine(max);
[解决办法]
一个排序问题,冒泡,二分 等都可以
学习C的时候就学过

热点排行