::iterator iter; //迭代器
27 | string s;
28 | string s1[N]; //用来储存每一个反应物和生成物
29 | int left_sum = 0, right_sum = 0, iloc; //分别记录反应物、生成物种类和等号的下标
30 | int sum, D; //sum=left_sum+right_sum,D为行列式的值
31 | int flag = 1;
32 | ~MainWindow();
33 |
34 | int gcd(int a, int b);
35 | void ReadElem();
36 | int E_GetInt(string temp, int pos);
37 | int check(int i);
38 | string check1(int k);
39 | int GetInt(string temp, int pos);
40 | void ToMatr();
41 | int determinant(int n);
42 | void solve();
43 | void InitAll();
44 | string DelSpace(string s);
45 | QString rslt;
46 | void paintEvent(QPaintEvent *event);
47 | void mousePressEvent(QMouseEvent *event);
48 | void mouseMoveEvent(QMouseEvent *event);
49 | QPoint last_mouse_position_;
50 | private slots:
51 | void on_pushButton_3_clicked();
52 |
53 | void on_pushButton_clicked();
54 |
55 | void on_pushButton_2_clicked();
56 |
57 | void on_pushButton_4_clicked();
58 |
59 | private:
60 | Ui::MainWindow *ui;
61 | bool eventFilter(QObject *watched, QEvent *event);
62 | QString cal(QString old);
63 | void InitElem();
64 | Form *form;
65 |
66 |
67 | };
68 | #endif // MAINWINDOW_H
69 |
--------------------------------------------------------------------------------
/Graphical source code/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 300
11 |
12 |
13 |
14 |
15 | 800
16 | 300
17 |
18 |
19 |
20 |
21 | 800
22 | 300
23 |
24 |
25 |
26 | Chemical Balancer
27 |
28 |
29 |
30 | :/img/icon.ico:/img/icon.ico
31 |
32 |
33 | 1.000000000000000
34 |
35 |
36 | false
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 110
49 | 130
50 | 641
51 | 41
52 |
53 |
54 |
55 |
56 | 12
57 |
58 |
59 |
60 |
61 |
62 |
63 | 110
64 | 190
65 | 641
66 | 41
67 |
68 |
69 |
70 |
71 | 12
72 |
73 |
74 |
75 | true
76 |
77 |
78 |
79 |
80 |
81 | 20
82 | 140
83 | 91
84 | 21
85 |
86 |
87 |
88 |
89 | 12
90 |
91 |
92 |
93 | 化学方程:
94 |
95 |
96 |
97 |
98 |
99 | 20
100 | 200
101 | 91
102 | 21
103 |
104 |
105 |
106 |
107 | 12
108 |
109 |
110 |
111 | 配平结果:
112 |
113 |
114 |
115 |
116 |
117 | 630
118 | 260
119 | 141
120 | 20
121 |
122 |
123 |
124 |
125 | 12
126 |
127 |
128 |
129 | Powerd by:AMT
130 |
131 |
132 |
133 |
134 |
135 | 340
136 | 10
137 | 121
138 | 121
139 |
140 |
141 |
142 |
143 | 12
144 |
145 |
146 |
147 | image: url(:/img/1.jpeg);
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 | 690
157 | 10
158 | 50
159 | 46
160 |
161 |
162 |
163 |
164 | 50
165 | 50
166 |
167 |
168 |
169 |
170 | 22
171 |
172 |
173 |
174 | image: url(:/img/3.jpg);
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 | 640
184 | 10
185 | 50
186 | 46
187 |
188 |
189 |
190 |
191 | 50
192 | 50
193 |
194 |
195 |
196 |
197 | 22
198 |
199 |
200 |
201 | image: url(:/img/1.jpg);
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 | true
210 |
211 |
212 |
213 | 740
214 | 10
215 | 50
216 | 46
217 |
218 |
219 |
220 |
221 | 0
222 | 0
223 |
224 |
225 |
226 |
227 | 50
228 | 50
229 |
230 |
231 |
232 |
233 | 22
234 |
235 |
236 |
237 | image: url(:/img/2.jpg);
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 | :/img/yjtp (1).ico:/img/yjtp (1).ico
248 |
249 |
250 | 帮助
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
--------------------------------------------------------------------------------
/Graphical source code/res.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | yjtp (1).ico
4 | style.qss
5 | 2.jpg
6 | 3.jpg
7 | 1.jpg
8 | 1.jpeg
9 | icon.ico
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Graphical source code/style.qss:
--------------------------------------------------------------------------------
1 | QPushButton
2 | {
3 | background-color:transparent;;
4 | }
5 |
--------------------------------------------------------------------------------
/Graphical source code/yjtp (1).ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AMT-J/Chemical-Balancer/bdff545006108a02709a6a5e9c44b7a8932c28d5/Graphical source code/yjtp (1).ico
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 AMT
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README-cn.md:
--------------------------------------------------------------------------------
1 | 化学配平器
2 |
3 | English |
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 | ::= "0" | "1" | ... | "9"
31 | ::= |
32 | ::= | "(" ")" | "[" "]"
33 | ::= |
34 | ::= "A" | "B" | ... | "Z"
35 | ::= "a" | "b" | ... | "z"
36 | ```
37 | ## 应用
38 | - [下载](https://github.com/AMT-J/Chemical-Balancer/releases/tag/v1.0)
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Chemical Balancer
2 |
3 | English |
4 | 中文
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | ## Introduction
20 |
21 | - This program can realize the balance of chemical and ionic equations and check whether they are balanced
22 | - The rules for entering chemical equations are as follows:
23 |
24 | ```
25 | ::= "="
26 | ::= | "+"
27 | ::= | "" |
28 | ::= "<""+>" | "<""->" | ""
29 | ::= {}
30 | ::= "0" | "1" | ... | "9"
31 | ::= |
32 | ::= | "(" ")" | "[" "]"
33 | ::= |
34 | ::= "A" | "B" | ... | "Z"
35 | ::= "a" | "b" | ... | "z"
36 | ```
37 | ## Apply
38 | - [Download](https://github.com/AMT-J/Chemical-Balancer/releases/tag/v1.0)
39 |
--------------------------------------------------------------------------------