#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);
}
}
puaex怎么样?puaex是一家去年成立的国人商家,本站也分享过几次,他家主要销售香港商宽的套餐,给的全部为G口带宽,而且是不限流量的,目前有WTT和HKBN两种线路的方面,虽然商家的价格比较贵,但是每次补一些货,就会被抢空,之前一直都是断货的状态,目前商家进行了补货,有需要这种类型机器的朋友可以入手。点击进入:puaex商家官方网站Puaex香港vds套餐:全部为KVM虚拟架构,G口的带宽,可...
virmach这是第二波出这种一次性周期的VPS了,只需要缴费1一次即可,用完即抛,也不允许你在后面续费。本次促销的是美国西海岸的圣何塞和美国东海岸的水牛城,周期为6个月,过后VPS会被自动且是强制性取消。需要临时玩玩的,又不想多花钱的用户,可以考虑下!官方网站:https://www.virmach.comTemporary Length Service Specials圣何塞VPS-一次性6个...
RAKsmart 商家估摸着前段时间服务器囤货较多,这两个月的促销活动好像有点针对独立服务器。前面才整理到七月份的服务器活动在有一些配置上比上个月折扣力度是大很多,而且今天看到再来部分的服务器首月半价,一般这样的促销有可能是商家库存充裕。比如近期有一些服务商挖矿服务器销售不好,也都会采用这些策略,就好比电脑硬件最近也有下降。不管如何,我们选择服务器或者VPS主机要本着符合自己需求,如果业务不需要,...