成绩统计
#include<iostream>
using namespace std;
void chengji(const float s[5][3] );
int main( ) {
float s[5][3];
int i,j;
for (i=0;i<5;i++)
for (j=0;j<3;j++)
cin>>s[i][j];
chengji(s);
return 0;
}
void chengji(const float s[5][3])
{
int i,j;
float sum=0;
for(i=0;i<5;i++)
{for(j=0;j<3;j++)
sum=sum+s[i][j];
cout<<"第"<<i+1<<"个人:"<<endl;
cout<<"总成绩:"<<sum<<endl;
cout<<"平均成绩:"<<sum/3<<endl;
}
}
using namespace std;
void chengji(const float s[5][3] );
int main( ) {
float s[5][3];
int i,j;
for (i=0;i<5;i++)
for (j=0;j<3;j++)
cin>>s[i][j];
chengji(s);
return 0;
}
void chengji(const float s[5][3])
{
int i,j;
float sum=0;
for(i=0;i<5;i++)
{for(j=0;j<3;j++)
sum=sum+s[i][j];
cout<<"第"<<i+1<<"个人:"<<endl;
cout<<"总成绩:"<<sum<<endl;
cout<<"平均成绩:"<<sum/3<<endl;
}
}