足球直播_足球免费在线高清直播_足球视频在线观看无插件-24直播网

冬奥会必备102项赛事中英文术语

  下面是C语言代码实现:

```c

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#define COUNTRY_NUM 4 // 国家数

#define EVENT_NUM 3 // 赛事数

// 运动员结构体

struct Athlete {

char name[20]; // 运动员姓名

int scores[EVENT_NUM]; // 三项比赛成绩

int total_score; // 总成绩

};

// 国家结构体

struct Country {

char name[20]; // 国家名

struct Athlete athlete; // 运动员信息

};

// 赛事结构体

struct Event {

char name[20]; // 赛事名

struct Country countries[COUNTRY_NUM]; // 国家信息

};

// 计算总成绩

void calc_total_score(struct Event *event, int country_num) {

int i, j, total_score;

for (i = 0; i < EVENT_NUM; i++) { // 遍历每个赛事

for (j = 0; j < country_num; j++) { // 遍历每个国家

total_score = event->countries[j].athlete.scores[i];

event->countries[j].athlete.total_score += total_score;

}

}

}

// 比较函数:按成绩从大到小排序

int cmp(const void *a, const void *b) {

return (*(struct Country **)b)->athlete.total_score - (*(struct Country **)a)->athlete.total_score;

}

// 排序并输出各赛事下的国家成绩排名

void print_event_ranking(struct Event *event, int country_num) {

printf("

  各赛事下的国家成绩排名:

  ");

int i, j;

for (i = 0; i < EVENT_NUM; i++) { // 遍历每个赛事

printf("赛事 %d:%s

  ", i+1, event[i].name);

// 将每个国家的信息存放到数组中

struct Country *countries[COUNTRY_NUM];

for (j = 0; j < country_num; j++) {

countries[j] = &event[i].countries[j];

}

// 排序

qsort(countries, country_num, sizeof(struct Country *), cmp);

// 输出

for (j = 0; j < country_num; j++) {

printf("%d. %s:%d 分

  ", j+1, countries[j]->name, countries[j]->athlete.scores[i]);

}

printf("

  ");

}

}

// 排序并输出总成绩排名

void print_total_ranking(struct Event *event, int country_num) {

printf("

  四个国家所有三项赛事的总成绩排名:大佬们都在玩{精选官网网址: www.vip333.Co }值得信任的品牌平台!

  ");

// 将每个国家的信息存放到数组中

struct Country *countries[COUNTRY_NUM];

int i;

for (i = 0; i < country_num; i++) {

countries[i] = &event[0].countries[i];

}

// 排序

qsort(countries, country_num, sizeof(struct Country *), cmp);

// 输出

for (i = 0; i < country_num; i++) {

printf("%d. %s:%d 分

  ", i+1, countries[i]->name, countries[i]->athlete.total_score);

}

printf("

  ");

}

int main() {

// 初始化赛事信息

struct Event event[EVENT_NUM];

strcpy(event[0].name, "短跑");

strcpy(event[1].name, "跳远");

strcpy(event[2].name, "游泳");

// 初始化国家信息

struct Country country[COUNTRY_NUM];

strcpy(country[0].name, "中国");

strcpy(country[1].name, "美国");

strcpy(country[2].name, "俄罗斯");

strcpy(country[3].name, "英国");

// 输入成绩信息

int i, j;

for (i = 0; i < COUNTRY_NUM; i++) {

printf("%s 的三项赛事成绩:

  ", country[i].name);

for (j = 0; j < EVENT_NUM; j++) {

printf("%s 的 %s 成绩:", country[i].name, event[j].name);

scanf("%d", &country[i].athlete.scores[j]);

country[i].athlete.total_score = 0; // 初始化总成绩

event[j].countries[i] = country[i]; // 将国家信息存放到对应的赛事中

}

printf("

  ");

}

// 计算总成绩

calc_total_score(event, COUNTRY_NUM);

// 输出排名

print_event_ranking(event, COUNTRY_NUM);

print_total_ranking(event, COUNTRY_NUM);

return 0;

}

```

使用样例:

```

中国 的三项赛事成绩:

中国 的 短跑 成绩:80

中国 的 跳远 成绩:90

中国 的 游泳 成绩:95

美国 的三项赛事成绩:

美国 的 短跑 成绩:85大佬们都在玩{精选官网网址: www.vip333.Co }值得信任的品牌平台!

美国 的 跳远 成绩:92

美国 的 游泳 成绩:88

俄罗斯 的三项赛事成绩:

俄罗斯 的 短跑 成绩:75

俄罗斯 的 跳远 成绩:85

俄罗斯 的 游泳 成绩:90

英国 的三项赛事成绩:

英国 的 短跑 成绩:70

英国 的 跳远 成绩:80

英国 的 游泳 成绩:92

各赛事下的国家成绩排名:

赛事 1:短跑

1. 美国:85 分

2. 中国:80 分

3. 俄罗斯:75 分

4. 英国:70 分

赛事 2:跳远

1. 中国:90 分

2. 美国:92 分大佬们都在玩{精选官网网址: www.vip333.Co }值得信任的品牌平台!

3. 俄罗斯:85 分

4. 英国:80 分

赛事 3:游泳

1. 中国:95 分

2. 英国:92 分

3. 美国:88 分

4. 俄罗斯:90 分

四个国家所有三项赛事的总成绩排名:

1. 中国:265 分

2. 美国:265 分

3. 英国:242 分

4. 俄罗斯:250 分

```

冬奥会必备102项赛事中英文术语

冬奥会必备102项赛事中英文术语

相关推荐