2024-08-27 21:58:35 +02:00
|
|
|
#ifndef RANK_H
|
|
|
|
#define RANK_H
|
|
|
|
|
|
|
|
#define M_STR 255
|
|
|
|
#define M_STR_LEN 255
|
|
|
|
|
|
|
|
struct Rank
|
|
|
|
{
|
2024-08-28 23:21:31 +02:00
|
|
|
int score;
|
|
|
|
char name[M_STR_LEN];
|
2024-08-27 23:07:20 +02:00
|
|
|
};
|
2024-08-27 21:58:35 +02:00
|
|
|
|
|
|
|
struct RankList
|
|
|
|
{
|
2024-08-28 23:21:31 +02:00
|
|
|
int rank_count;
|
2024-08-29 17:57:27 +02:00
|
|
|
char rank[M_STR][M_STR_LEN];
|
2024-08-28 23:21:31 +02:00
|
|
|
struct Rank srank[M_STR];
|
2024-08-27 23:07:20 +02:00
|
|
|
};
|
2024-08-27 21:58:35 +02:00
|
|
|
|
2024-08-28 23:21:31 +02:00
|
|
|
struct WRankList
|
|
|
|
{
|
|
|
|
int rank_count;
|
2024-08-29 17:57:27 +02:00
|
|
|
char rank[M_STR][M_STR_LEN];
|
2024-08-29 00:28:53 +02:00
|
|
|
struct Rank srank[3][M_STR];
|
|
|
|
};
|
2024-08-28 23:21:31 +02:00
|
|
|
|
2024-08-28 00:12:46 +02:00
|
|
|
struct Weighted
|
|
|
|
{
|
|
|
|
float opt1_w;
|
|
|
|
float opt2_w;
|
|
|
|
float opt3_w;
|
2024-08-28 23:21:31 +02:00
|
|
|
|
|
|
|
char opt1[M_STR_LEN];
|
|
|
|
char opt2[M_STR_LEN];
|
|
|
|
char opt3[M_STR_LEN];
|
2024-08-28 00:12:46 +02:00
|
|
|
};
|
|
|
|
|
2024-08-28 22:15:59 +02:00
|
|
|
/* for one big alloc operation instead of multiple */
|
|
|
|
struct WAlloc
|
|
|
|
{
|
2024-08-28 23:21:31 +02:00
|
|
|
struct Weighted w;
|
|
|
|
struct WRankList rl;
|
2024-08-28 22:15:59 +02:00
|
|
|
};
|
|
|
|
|
2024-08-28 00:12:46 +02:00
|
|
|
void isort(char [][M_STR], struct Rank[], int);
|
2024-08-29 00:28:53 +02:00
|
|
|
void rank(struct Rank *, int);
|
2024-08-28 00:12:46 +02:00
|
|
|
void print_ranklist(struct RankList *);
|
2024-08-27 21:58:35 +02:00
|
|
|
|
2024-08-29 17:57:27 +02:00
|
|
|
/* read string from stdin */
|
|
|
|
int rsstdin(char [][M_STR_LEN]);
|
2024-08-29 00:28:53 +02:00
|
|
|
|
2024-08-27 21:58:35 +02:00
|
|
|
#endif
|