⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 7-6.c

📁 供货价格环境规划结果会经过几个环节菲亚特体育馆推广体uygui黄金客户
💻 C
字号:
#define N 10
#define M 5
float score[N][M];
float a_stu[N],a_cour[M];
int r,c;
main()
{
	float highest();
	void input_stu(void);
	void aver_stu(void);
	void aver_cour(void);
	int i,j;
	float h;
	input_stu();
	aver_stu();
	aver_cour();
	printf("\n No: cour1 cour2 cour3 cour4 cour5 aver");
	for(i=0;i<N;i++)
	{printf("\n No: %2d",i+1);
	for(j=0;j<M;j++)
		printf("%8.2f",score[i][j]);
	printf("%8.2",a_stu[i]);
	}
	printf("\n aver:");
	for(j=0;j<M;j++)
		printf("%8.2f",a_cour[j]);
	h=highest();
	printf("\n highest:%8.2f No:%2d courese:%2d\n",h,r,c);
}
void input_stu(void)
{ 
	int i,j;
	for(i=0;i<N;i++)
	{printf("\n input score of student No:=%2d\n",i+1);
	for(j=0;j<M;j++)
		scanf("%f",&score[i][j]);
	}
}
void aver_stu(void)
{int i,j;
float s;
for(i=0;i<N;i++)
{
	for(j=0,s=0;j<M;j++)
		s+=score[i][j];
	a_stu[i]=s/5.0;
}
}
void aver_cour(void)
{
	int i,j;
	float s;
	for(j=0;j<M;j++)
	{
		s=0;
		for(i=0;i<N;i++);
		s+=score[i][j];
		a_cour[j]=s/(float)N;
	}
}
float highest()
{
	float high;
	int i,j;
	high=score[0][0];
	for(i=0;i<N;i++)
		for(j=0;j<M;j++)
			if(score[i][j]>=high)
			{high=score[i][j];
			r=i+1;
			c=j+1;}
			return (high);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -