首页 > Sentiment > 实验1__熟悉Project组织应用程序

实验1__熟悉Project组织应用程序

2008年2月28日 发表评论 阅读评论 448 views

test1.cpp

#include
#include#include “test1.h”
void main()
{
int i,a[10],N;
int res_max,res_min,res_aver;
int max,min,aver;
N=10;
for(i=0;i cin>>a[i];
cout<<"Testing Function aMAX:";
res_max=aMAX(a,N);
cout<<"max="< cout<<"Testing Function aMIN:";
res_min=aMIN(a,N);
cout<<"min="< cout<<"Testing Function aAVE:";
res_aver=aAVE(a,N);
cout<<"aver="< cout<<"Testing Function aMAX_MIN_AVE:";
aMAX_MIN_AVE(a,N,max,min,aver);
cout<<"Prime_sum="< cout<<"After sort:"< aSORT(a,N);
}

test1.h

int aMAX(int *a,int n)
{
int i,res;
res=a[0];
for(i=1;i if(res return res;
}
int aMIN(int *a,int n)
{
int i,res;
res=a[0];
for(i=1;i if(res>a[i]) res=a[i];
return res;
}
int aAVE(int *a,int n)
{
int res,i;
res=0;
for(i=0;i<=n;i++)
res+=a[i];
res/=n;
return res;
}
void aMAX_MIN_AVE(int *a, int n, int &max, int &min, int &aver)
{
int i;
max=min=aver=a[0];
for(i=1;i if(max if(min>a[i]) min=a[i];
aver+=a[i];
}
aver/=n;
cout<<"max="< cout<}

[sfile]http://imtimmy.com/wp-content/boblog/attachment/200802/1204171536_28368c69.rar[/sfile]

分类: Sentiment 标签: ,
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :cool: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O