| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 616 人关注过本帖
标题: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
快速回复:C#菜鸟问题求助
数据加载中...
 
   



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

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