不知道可否麻烦哪位改一下这个code
要求 用函数写一个 数组 然后输出最大的数
谢谢了
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
const int MAX_NO_OF_Number = 6;
int load_number(int array[]);
int find_largest(int array[]);
int main()
{
// Viarables local to the main
int array[MAX_NO_OF_Number];
int no_of_number;
int largest;
no_of_number = load_number( array);
largest = find_largest(array);
cout<<largest<<endl;
}
int load_number(int array[])
{
int i;
int no_of_number;
cout<<"Please enter 6 marks:"<<endl;
for (i = 0; i < MAX_NO_OF_Number; i ++)
{
cin>> array[i];
}
return 0;
}
int find_largest(int array[]){
int i=0;
int largest;
largest = array[0];
for(int i=0; i<MAX_NO_OF_Number; i ++)
{
if (array[i+1]>array[i])
largest = array[i+1];
else
largest = array[i];
i++;
}
}