come in>>
所在版块:求学狮城 发贴时间:2003-05-13 17:40

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
do u mean to find the max number of an array whoes size is 10?
if so..
I changed ur program a bit..
u can see the difference..


#include<iostream.h>
int max_element(int[], int);
void main(){
int n, a[10];
int max;
for(n=0; n<10; n ++)
cin>>a[n];
max=max_element(a, 10);
cout<<max;
cout<<endl;
}
int max_element(int array[] , int size){
int temp, j;
temp = array[0];
for(j=0; j<size; j++)
if(temp<array[j])
temp=array[j];
return temp;
}




.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

Don't forget to always have a dream
我曾是孤单的飞鸟
飘荡在远方的天空
如今我已飞得太久
才知道我就是春天
我用力地挥动翅膀
开始寻找家的方向
我用力地挥动翅膀
溶进这宽阔的天空
 相关帖子 我要回复↙ ↗回到正文
A C++ problem about array joyce   (625 bytes , 419reads )
This program is not pure C++ Flying   (0 bytes , 151reads )
You should declare the function before you use it 香陵居士   (202 bytes , 182reads )
只要把下面的函数体整个放到main前面就行了。 Livecn   (19 bytes , 179reads )
也算是declare了 香陵居士   (86 bytes , 171reads )
is it not backward compatible de mah? MrDJay   (38 bytes , 225reads )
It seems that you are really new to C/C++ 香陵居士   (75 bytes , 176reads )
thanks :$ MrDJay   (23 bytes , 161reads )
come in>> 我行故我   (490 bytes , 192reads )
what is this for? MrDJay   (19 bytes , 202reads )
guess it is the problem MrDJay   (0 bytes , 150reads )