100000581专题

Codeup[100000581]小白鼠排队

题目要求如下: 由于会输入小白鼠的体重和颜色,因此可以使用1个结构体将其封装起来。 之后调用排序函数按照体重大小进行排序,再输出其对应的颜色即可。 下面是实现的代码: #include <stdio.h>#include <stdlib.h>typedef struct {int weight;char color[10];} Rat;int rat_compare(const void *