现在的位置: 首页 > 综合 > 正文

成绩处理

2013年10月03日 ⁄ 综合 ⁄ 共 402字 ⁄ 字号 评论关闭
#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 h,i,j;
	double v;
	for(i=0;i<5;i++)
	{
		h=0;
		for(j=0;j<3;j++)
        {
		h=h+s[i][j];
		}
        v=h/3;
		cout<<"同学的成绩为:";
		for(i=0;i<5;i++)
		{
			cout<<endl;
			cout<<"第"<<i+1<<"同学的成绩为:";
			for(j=0;j<3;j++)
	    cout<<s[i][j]<<" ";
		cout<<h<<v<<endl;
        }
	}


}
 
 
 

运行结果:

 

 

 

抱歉!评论已关闭.