using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static int MaxValue(int[] intArray)
{
int maxVal = intArray[0];
for (int i = 1; i < intArray.Length; i++)
{
if (intArray[i] > maxVal)
maxVal = intArray[i];
}
return maxVal;
}
static void Main(string[] args)
{
//int[] myArray = {1,23,45,34,53,52,64,111};
//int maxVal = MaxValue(myArray);
//Console.Write("数组中的最大值是:{0}",maxVal);
//Console.ReadKey();
int[] myArray ={0,0,0,0,0 };
int i=0;
do
{
Console.Write("请输入N个数据,用逗号隔开!");
myArray[i] = Convert.ToInt32(Console.ReadLine());
i++;
}while(Console.ReadLine().ToString() != "e");
int max =MaxValue(myArray);
// max(a,b);
Console.WriteLine("你输入的最大值是:{0}", max);
Console.ReadKey();
}
}
}