| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 524 人关注过本帖
标题:[求助]一道关于数组的题目
取消只看楼主 加入收藏
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
快速回复:[求助]一道关于数组的题目
数据加载中...
 
   



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

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