标题:[求助]一道关于数组的题目
取消只看楼主
aimarho8308
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-2-10
 问题点数:0 回复次数:0 
[求助]一道关于数组的题目

不知道可否麻烦哪位改一下这个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++;
}

}


搜索更多相关主题的帖子: include 最大的 local 
2006-03-17 15:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-51055-1-1.html




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

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