Skip to content

Commit a468e1f

Browse files
committed
some modifs to hw0201.c
1 parent 9e3e181 commit a468e1f

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

‎other/makefile‎

Whitespace-only changes.

‎other/tideman.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "tideman.h"
2+
3+
int main(int argc, string argv[])
4+
{
5+
6+
7+
8+
return 0;
9+
}

‎other/tideman.h‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#pragma once
2+
3+
// libraries
4+
#include <stdio.h>
5+
#include <stdint.h>
6+
#include <stdlib.h>
7+
#include <string.h>
8+
9+
// macro constants
10+
#define MAX 9
11+
12+
// function prototypes
13+
bool vote(int rank, string name, int ranks[]);
14+
bool cycle_pairs(int start, int endCase);
15+
void record_preferences(int ranks[]);
16+
void add_pairs(void);
17+
void sort_pairs(void);
18+
void lock_pairs(void);
19+
void print_winner(void);
20+
21+
// global variables cause cs50 is kinda cringe
22+
int32_t preferences[MAX][MAX];
23+
bool locked[MAX][MAX];
24+
int32_t pair_count;
25+
int32_t candidate_count;
26+
27+
// structs
28+
typedef struct
29+
{
30+
int32_t winner;
31+
int32_t loser;
32+
}
33+
pair;
34+
35+
string candidates[MAX];
36+
pair pairs[MAX * (MAX - 1) / 2];
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "myIrrational.h"
2-
// driver code
2+
33
int main(){
44

55
uint16_t n = getNum();
66

77
menu(n);
88

99
return 0;
10-
}
10+
}

0 commit comments

Comments
 (0)