标题:C#菜鸟问题求助
取消只看楼主
fish1985
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-8-21
 问题点数:0 回复次数:1 
C#菜鸟问题求助

Question:Input a array A with N numbers,where N>1 and N could be very large(more than 1000)
Then search the largest and smallest item in the array.

The following is what I did for searching the largest and smallest item in the array:
public static void CompareArrayElement(int [] array, int n)
{
int MaxValue=array[0];
int MinValue=array[0];


for(int index=0;index<n-1;index++)
{
if(array[index]<MinValue)
array[index]=MinValue;

// return MinValue;
else
if(array[index]>MaxValue)
array[index]=MaxValue;
// return MaxValue;
else continue;

}
Console.WriteLine("MaxValue="+MaxValue);
Console.WriteLine("MinValue="+MinValue);


}

My problem is how to input so large number of items in the array.Due to the huge number,I cannot fill the array manually.
我朋友告诉我说用参数传递,请问该怎么做?
谢谢.

搜索更多相关主题的帖子: void searching following numbers public 
2006-08-21 15:07
fish1985
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-8-21
得分:0 

谢谢大家,此问题已解决.

2006-08-22 21:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-85267-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.232459 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved