-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculator.h
50 lines (46 loc) · 1.34 KB
/
calculator.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
#ifndef CULATOR_H
#define CULATOR_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <iomanip>
//#include <conio.h>
//#include <process.h>
#include <math.h>
#include <fstream>
//#include <windows.h>
#include <string>
#include <QString>
#define MAX 100
using namespace std;
class polynomial{
public:
double Coefficient;
int index;
int Rauk;
polynomial *next;
};
class calculator{
public:
calculator();
double Realization(char *str); //确定系数及其正负
void push(polynomial *head,double Coefficient,int index) ;//新项加入单链表
QString Build(QString a, int mp);//构建多项式
void xue(polynomial *head);//多项式合并同幂项
void del(polynomial *DLList1,double Coefficient,int index);//删除
void sort(polynomial *DLList1);//降幂排序
void Inverselist(polynomial *DLList1);//逆置
QString algorithm(int CD);//加/减计算
QString Formattedoutput(polynomial *abc);//格式化输出
void quick(polynomial *Ac);//清除指定多项式
void clear();//清除所有多项式
bool check(QString strr);//检查字符串合法性
QString calX(int x,polynomial *head);
QString calX1(int i);
private:
polynomial *Aa=new polynomial;
polynomial *Bb=new polynomial;
polynomial *Cc=new polynomial;
};
#endif // CALCULATOR_H