-
Notifications
You must be signed in to change notification settings - Fork 0
/
mylib.h
171 lines (126 loc) · 3.48 KB
/
mylib.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#ifndef H_MYLIB
#define H_MYLIB
/*!
---------------------------------------------
Compares a number double type with zero
\param [in] a number to compare against zero
\return true if a if null else false
---------------------------------------------
*/
// isZero
int isNull(double);
/*!
-----------------------------------
Produces formatted output depending on the number of roots
\param [in] nRoots number of roots
\param [in] x1 1-st root
\param [in] x2 2-nd root
------------------------------------
*/
void pretyPrintRoots(int, double, double);
/*!
-----------------------------------
Cleans the booth of the buffer
-----------------------------------
*/
void clearBuffer();
/*!
-----------------------------------
Looks for the quit keyword in user input
\return True if it find the word "quit" else false
-----------------------------------
*/
int findQuit();
/*!
---------------------------------------------
Tests solveKvadratka()
---------------------------------------------
*/
void testSK();
/*!
---------------------------------------------
Tests a single case
\param a-coef a-coeficient
\param b-coef b-coeficient
\param c-coef c-coeficient
\param tnRoots correct number of roots
\param tx1 correct value of the 1-st root
\param tx2 correct value of the 2-nd root
\return Test status
---------------------------------------------
*/
// code???
void test_case(double, double, double, int, double, double);
/*!
---------------------------------------------
Compares two numbers double type
\param [in] a 1-st number
\param [in] b 2-nd number
\return true if the numbers are equal else false
---------------------------------------------
*/
int compareDouble(double, double);
/*!
-----------------------------------
Processes user input, reads values of equation arguments
\param [in] pa_coef pointer on a-coeficient
\param [in] pb_coef pointer on b-coeficient
\param [in] pc_coef pointer on c-coeficient
\return Status of input
-----------------------------------
*/
int userInput(double*, double*, double*);
/*!
--------------------------------------------
For the given coefficients of the linearal equation b c looks for its roots and writes x
\param [in] b_coef b-coefficient
\param [in] c_coef c-coefficient
\param [out] px pointer to the root
\return Number of roots
--------------------------------------------
*/
int solveLineyka(double, double, double*);
/*!
--------------------------------------------
For the given coefficients of the quadratic equation a b c looks for its roots and writes x1 and x2
\param [in] a_coef a-coefficient
\param [in] b_coef b-coefficient
\param [in] c_coef c-coefficient
\param [out] px1 pointer to the first root
\param [out] px2 pointer to the second root
\return Number of roots
--------------------------------------------
*/
// double a, double b, double c, double *x1, double *x2??
int solveKvadratka(double, double, double, double*, double*);
/*!
-----------------------------------
Binds user input and equation solution
-----------------------------------
*/
// ??
// choose_start_mode()
void startSolveKvadratka();
/*!
-----------------------------------
Search extra characters in input
\return True if extra characters are else false
-----------------------------------
*/
// ????
int findExtraChars();
// NUMBER_OF_ROOTS
enum NumberOfRoots
{
NULL_ROOTS = 0,
ONE_ROOT = 1,
TWO_ROOTS = 2,
INF_SOL = 3
}
// enum STATUS {}
enum STATUS_ANSWER
{
WRONG = 0,
CORRECT = 1
};
#endif