从100个数字中查找最小的数字...?
问题描述:
我想使用vb6从100多个数字中找到最小的数字.
I want to find smallest number from more than 100 numbers using vb6.
答
对数字进行迭代,并跟踪您拥有的最小数字到目前为止发现.最后,您将拥有最小的.我不了解VB6,但方法相当简单.
Iterate through the numbers, and keep track of the smallest one you''ve found so far. At the end, you''ll have the smallest. I don''t know VB6 but the method is fairly straight forward.
尝试以下代码:
Try this codes:
int lowest = 2147483647;
int[] nums = {4,2,1,74,6,77};
foreach(int num in nums)
{
if(num < lowest)
{
lowest = num;
}
}
问候,
爱德华
Regards,
Eduard