-
Notifications
You must be signed in to change notification settings - Fork 0
/
complex.h
55 lines (35 loc) · 839 Bytes
/
complex.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
# ifndef COMPLEX_H
#include <stddef.h>
#define MAX 15
#define FALSE 0
#define OK 1
#define FOREVER for (;;)
#define MAX_COMMANDS 9 /* Define this constant for the number of commands */
#define ASCII_A 65
/* Error codes */
#define ERROR_INVALID_NUMBER -1
#define ERROR_MISSING_COMMA -2
#define ERROR_EXTRANEOUS_TEXT -3
#define NO_PARAM -4
#define BUFFER_OVERFLOW -5
typedef struct complex {
double real;
double img;
} complex;
void print_comp(void);
void abs_comp(void);
void add_comp(void);
void sub_comp(void);
void mult_comp_comp(void);
void mult_comp_real(void);
void mult_comp_img(void);
void read_comp(void);
void stop(void);
void print_error_message(int error_code);
/* Structure to save a name for every command */
typedef struct {
char *name;
void (*func)(void);
} Cmd;
extern Cmd cmd[];
# endif