#include <stdio.h> #include <stdlib.h> #include <string.h>
struct STU { long Num; int mathScore; int englishScore; puterScore; int allScore; int averageScore; };
void sort(); void cal(); void stuPrint(); void stuInput();
#define STUNUM 60/*定义学生数*/
STU stu[STUNUM];
int main(int argc, char* argv[]) { stuInput(); cal(); sort(); stuPrint();
return 0; }
void stuInput() { int i = 0; for (;i<STUNUM;i++) { system("cls"); printf("请一个学生输入学号 "); scanf("%d",&(stu[i].Num)); printf("请输入该学生数学成绩 "); scanf("%d",&(stu[i].mathScore)); printf("请输入该学生英语成绩 "); scanf("%d",&(stu[i].englishScore)); printf("请输入该学生计算机成绩 "); scanf("%d",&(stu[i]puterScore)); } }
void cal() { int i = 0; for (;i<STUNUM;i++) { stu[i].allScore = stu[i].mathScore + stu[i]puterScore + stu[i].englishScore; stu[i].averageScore = stu[i].allScore / 3; } }
void sort() { STU temp; int i = 0 , j =0; for (;i<STUNUM-1;i++) { for ( j = i+1;j< STUNUM ;j++) { if (stu[i].allScore<stu[j].allScore) {
memcpy(&temp,&stu[i],sizeof(STU)); memcpy(&stu[i],&stu[j],sizeof(STU)); memcpy(&stu[j],&temp,sizeof(STU)); } } }
}
void stuPrint() { int i = 0; printf("名次 学号 数学成绩 英语成绩 计算机成绩 总成绩 平均成绩 "); for (;i<STUNUM;i++) { printf(" --------------------------------------------------------- "); printf("%d %d %d %d %d %d %d ",i+1,stu[i].Num,stu[i].mathScore, stu[i].englishScore,stu[i]puterScore, stu[i].allScore,stu[i].averageScore);
}
}
青云互联怎么样?青云互联美国洛杉矶cn2GIA云服务器低至19元/月起;香港安畅cn2云服务器低至19元/月起;日本cn2云主机低至35元/月起!青云互联是一家成立于2020年的主机服务商,致力于为用户提供高性价比稳定快速的主机托管服务。青云互联本站之前已经更新过很多相关文章介绍了,青云互联的机房有香港和洛杉矶,都有CN2 GIA线路、洛杉矶带高防,商家承诺试用7天,打死全额退款点击进入:青云互联...
Hostodo商家算是一个比较小众且运营比较久的服务商,而且还是率先硬盘更换成NVMe阵列的,目前有提供拉斯维加斯和迈阿密两个机房。看到商家这两年的促销套餐方案变化还是比较大的,每个月一般有这么两次的促销方案推送,可见商家也在想着提高一些客户量。毕竟即便再老的服务商,你不走出来让大家知道,迟早会落寞。目前,Hostodo有提供两款大流量的VPS主机促销,机房可选拉斯维加斯和迈阿密两个数据中心,且都...
EdgeNat 商家在之前也有分享过几次活动,主要提供香港和韩国的VPS主机,分别在沙田和首尔LG机房,服务器均为自营硬件,电信CN2线路,移动联通BGP直连,其中VPS主机基于KVM架构,宿主机采用四路E5处理器、raid10+BBU固态硬盘!最高可以提供500Gbps DDoS防御。这次开年活动中有提供七折优惠的韩国独立服务器,原生IP地址CN2线路。第一、优惠券活动EdgeNat优惠码(限月...