#include<iostream.h>
int average(int score[8]);
void main()
{
int score[8];
cout<<"请输入同学的成绩:"<<endl;
for(int i=0;i<8;i++)
{
cout<<score[i]<<endl;
cin>>score[i];
}
int aA=average(score);
}
int average( int score[8])
{
int sum=0;
int average;
for(int i=0;i<8;i++)
{
sum+=score[i];
}
average=sum/8;
cout<<"平均分为:"<<average<<endl;
return average;
}
#include<iostream.h>
int average(int score[8]);
void main()
{
int score[8];
cout<<"请输入同学的成绩:"<<endl;
for(int i=0;i<8;i++)
{
cout<<score[i]<<endl;
cin>>score[i];
}
int aA=average(score);
}
int average( int score[8])
{
int sum=0;
int average;
for(int i=0;i<8;i++)
{
sum+=score[i];
}
average=sum/8;
cout<<"平均分为:"<<average<<endl;
return average;
}