critical-thinking/rank.h

50 lines
793 B
C
Raw Normal View History

#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
};
struct RankList
{
2024-08-28 23:21:31 +02:00
int rank_count;
2024-08-27 23:07:20 +02:00
struct Rank rank[M_STR];
2024-08-28 23:21:31 +02:00
struct Rank srank[M_STR];
2024-08-27 23:07:20 +02:00
};
2024-08-28 23:21:31 +02:00
struct WRankList
{
int rank_count;
struct Weighted rank[M_STR];
struct Weighted srank[3][M_STR];
}
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 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
};
void isort(char [][M_STR], struct Rank[], int);
void rank(struct RankList *);
void print_ranklist(struct RankList *);
#endif