-
Notifications
You must be signed in to change notification settings - Fork 0
/
number.h
49 lines (38 loc) · 875 Bytes
/
number.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
//
// Created by adeshchoudhar on 16/07/21.
//
#ifndef BC_NUMBER_H
#define BC_NUMBER_H
#include "helpers.h"
#define PLUS 1
#define MINUS -1
#define ORD(x) x - '0'
#define CHR(x) x + '0'
typedef struct Digit {
int value;
struct Digit *next;
struct Digit *prev;
} Digit;
typedef struct Number {
int sign;
int length;
Digit *head;
Digit *tail;
} Number;
Digit *init_digit(int);
Number *init_number();
void insert_back(Number *, char);
void insert_front(Number *, char);
void remove_back(Number *);
void remove_front(Number *);
bool is_zero(Number *);
int odd_even(Number *);
bool is_binary(Number *);
void copy_number(Number *, Number *);
void show_number(Number *);
void show_numbers(int, ...);
void modify_number(Number *);
void modify_numbers(int, ...);
void delete_number(Number *);
void delete_numbers(int, ...);
#endif //BC_NUMBER_H