-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.h
109 lines (88 loc) · 2.38 KB
/
function.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
#ifndef POLYNUM_H
#define POLYNUM_H
#include <QObject>
#include <qstack.h>
#include <qmath.h>
#include <QHash>
class Function;
struct func ;
const double pi = 22.0/7 ;
struct poly
{
poly()
{
this->L = this->R = NULL ;
this->operat = NULL ;
this->elem = NULL ;
}
func* elem ;
QChar operat ;
poly* R ;
poly* L ;
};
struct func
{
func()
{
this->con = 0;
this->expen = NULL ;
this->id = "con";
this->pow = 0 ;
}
QString id ;
double con ;
double pow ;
poly* expen ;
};
class Function
{
public:
poly* Root ;
Function();
Function(QString);
Function(func );
Function(poly*);
Function(const Function & );
Function(const double);
~Function();
static bool checkpoly (QString str );
void fixup();
double F (double value_x);
poly* Determine(QString str);
void AddToTree(poly * &T,QString str);
void Add_ConstToDic(QString str ,double valu) ;
void operator =(const Function& Exp);
void operator +=(const Function& Exp);
void operator -=(const Function& Exp);
void operator *=(const Function& Exp);
Function operator *(const Function& Exp);
Function operator +(const Function& Exp);
Function operator -(const Function& Exp);
Function operator *(const QString str);
Function operator +(const QString str);
Function operator -(const QString str);
void operator +=(const QString str);
void operator *=(const QString str);
Function operator *(const double other);
Function operator +(const double other);
Function operator -(const double other);
void operator +=(const double other);
void operator *=(const double other);
void insertfunc(func );
void clear_Function ();
QString ToQString ();
static void init();
private :
void copy_func(const func* From,func* &TO);
void Help_copy(const poly* Exp,poly* &new_Exp);
void copy(const Function &Exp,Function &To);
void delete_func(func* &f);
void Help_Delete(poly* &Exp);
void Delete(Function&);
void printpoly(poly* T,QString & );//To String
double valu_Function (poly * & T,double value_x);
// jebory commits
void ProssPluse(poly*);
void ProssMul(poly*);
};
#endif // POLYNUM_H