-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
94 lines (86 loc) · 2 KB
/
test.cpp
File metadata and controls
94 lines (86 loc) · 2 KB
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
#include <fstream>
#include "linklist.h"
#include "operation.h"
#define Max 10000
int main() {
//向文件中写的字符串
string out;
cout << "请按照格式要求输入两个数值进行加减运算,如果想要进行幂运算,只需把数值放在两个数的第一个即可:";
cin >> out;
int operation = 1;
ifstream fin;
ofstream fout;
fout.open("input.txt");
if (fout.is_open()) {
fout << out;
fout.close();
}
fin.open("input.txt");
if (fin.is_open() == false) {
cout << "Can't open file ,Bye Bye.\n";
exit(EXIT_FAILURE);
}
string input;
getline(fin, input, ';');
string one = input;
input.clear();
getline(fin, input, ';');
string two = input;
cout << "\n-------------欢迎各位来到恐怖的!可怕的!让你旋转爆炸的RJzz的长整数四则运算系统---------------\n";
cout << "1.加法计算\n" << "2.减法计算\n" << "3.乘法计算\n" << "4.除法计算\n"
<< "5.幂运算\n" << "6.阶乘运算\n" << "输入0退出系统\n";
while (operation) {
cout << "请输入你要进行的操作序号: ";
cin >> operation;
Operation *op = new Operation();
LinkList *test = new LinkList(one);
test->Init();
LinkList *test1 = new LinkList(two);
test1->Init();
switch (operation) {
case 1:
op->Compare(*test, *test1);
op->Add();
cout << "加法运算的结果为:";
op->Output();
break;
case 2:
op->Compare(*test, *test1);
op->Sub();
cout << "减法运算的结果为:";
op->Output();
break;
case 3:
op->Multiply(*test, *test1, 0);
cout << "乘法运算的结果为:";
op->Output();
break;
case 4:
op->Division(*test, *test1);
cout << "除法运算运算的结果为:";
op->Output();
cout << "余数为: " << op->get_divisionlist().get_link() << endl;
break;
case 5:
int n;
cout << "请输入你想要进行计算的指数的值: ";
cin >> n;
op->Involution(*test, n);
op->Output();
break;
case 6:
cout << "时间问题,还没做出来" << endl;
break;
default:
break;
}
delete op;
delete test;
delete test1;
}
cout << "Thanks,求教一种效率高的除法,本系统的除法个人觉得效率太低";
fin.clear();
fin.close();
system("PAUSE");
return 0;
}