-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph.h
57 lines (50 loc) · 1.36 KB
/
graph.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <stddef.h>
typedef struct {
double line;
double probability;
} GraphLine;
typedef struct {
GraphLine* graphLines;
double max;
double min;
size_t used;
size_t size;
int null;
} Graph;
typedef struct {
char *operators;
double *numbers;
int op_count;
int num_count;
} Equation;
struct arguments {
char *equation;
int verbose;
int best;
char best_type;
int best_num;
int target;
char target_inequality[4];
float target_num;
int multiple;
int multiple_num;
int graph;
char graph_inequality[4];
int round;
char round_type;
};
// factorial function
double factorial(double n);
// evaluate_equation, but performed on an entire graph
Graph evaluate_equation_graph(Equation *equation, struct arguments *arguments);
// create and return a graph for a given roll
Graph graph(char op, double left, double right);
int find_graph_line(Graph* graph, int l, int r, double line);
int find_insert_index(Graph* graph, int l, int r, double line);
// dynamic array functions
void init_graph(Graph* in, size_t initSize);
void insert_into_graph(Graph* in, GraphLine* element);
void insert_into_graph_sorted(Graph* in, GraphLine* element);
void free_graph(Graph* in);
// combines two graphs into a new one, then frees the input graphs
Graph* combine_graphs(char op, Graph* left, Graph* right);