c语言关于加权平均分计算奖学金的问题

2020-10-19 财经 95阅读
手打的 但没编译检查是否正确- -~
#include
#define KECHENG 12
#define JIANGJIN_LINE 82.13
#define JIGE 60
#define KEMU 12
#define TRUE 1
#define FALSE 0
void input_Num(int *Num)
{
printf("input Num \r\n");
scanf("%d",Num);
}
void input_Chengji(int *Xuefen,int *Chengji)
{
int i;
for(i=0;i {
printf("input No. %d Xuefen \r\n",i);
scanf("%d",&Xuefen[i]);
printf("input No. %d Chengji \r\n",i);
scanf("%d",&Chengji[i]);
}
}
int Sum_Xuefen(int *Xuefen)
{
int Result;
int i;
Result = 0;
for(i=0;i {
Result = Result + Xuefen[i];
}
return Result;

}
int Sum_Chengji(int *Chengji)
{
int Result;
int i;
Result = 0;
for(i=0;i {
Result = Result + Chengji[i];
}
return Result;

}
int Output_JiGeCheck(int *Chengji)
{
int i;
int Result;
Result = TRUE;
for(i=0;i {
if(Chengji[i]<60)
{
Result = FALSE;
break;
}
}
return Result;
}
void OutputResult()
{
int T;
int i;
int L;
int chengji[KEMU];
int xuefen[KEMU];
float MaxChengji;
float TempChengji;
MaxChengji = JIANGJIN_LINE;
L = 0;
input_Num(&T);
for(i=0;i {
input_Chengji(&xuefen[0],&chengji[0]);
if(TRUE == Output_JiGeCheck(&chengji[0])
{
TempChengji = Sum_Chengji(&chengji[0])/Sum_Xuefen(&xuefen[0]);
}
if(TempChengji > JIANGJIN_LINE)
{
L++;
if(TempChengji > MaxChengji)
{
MaxChengji = TempChengji;
}
}
}
printf("%.2f , %d",MaxChengji,L);
}
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com