|
藍森林 http://www.lslnet.com 2006年6月6日 10:18
Anyone can help me...Thanks
A program that asks the user to enter a list of integers. 程式是會決定輸入Number中的最大值和最大值一共輸入了多少次. For example, 如輸入了下列幾組數字
5 2 15 3 7 15 8 9 5 2 15 3 7
輸出最大值為15和一共輸入了 3次.
如何計出我共輸入了15這number三次..?
thanks.. |
Anyone can help me...Thanks
max=-1; num=0;
foreach element in array
{
if element >;max {max=element; num=1); }
else if element==max num++;
} |
| |