四则运算发布版

合作开发者:贾兆款:http://www.cnblogs.com/seven-seven/p/5361599.html

四则运算发布版采用了在线答题的模式,使用了jsp+javabean的模式

程序源代码:

index.jsp(主界面):

 

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
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.math.BigDecimal" %>
<%@ page import="MyBean.JavaBean" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
     
    <title>在线答题系统</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
     
     <style type="text/css">   
     body{   
           background-image: url(img/picture1.jpg);   
           background-repeat: repeat-y;   
         }   
     </style>
     
    <script language="javascript">
    function checkArray(){
    if((form1.max.value-form1.min.value+1)<form1.count.value)
    {
    alert("数值范围输入错误,请重新输入数值范围(友情提示:数值范围应大于运算式的数量)!");
    form1.min.value="";
    form1.max.value="";
    form1.count.value="";
    form1.min.focus();
    return false;
    }
    }
    </script>
     
  </head>
   
  <body>
    <font color=Green>
    <center color="green">欢迎来到在线答题系统</center><br>
    <center>请选择是否含有以下几种限制:
    <form name="form1" action="" method="post" onSubmit="return checkArray()">
    <table color=Green>
    <tr>
    <td style="color:#FF6600;">
    <p>
    真分数:
    <select size="1" name="properfraction">
    <option selected value="1">是</option>
    <option value="0">否</option>
    </seltct>
    </p>
    </td>
    <td style="color:#FF6600;">
    <p>
    乘除法:
    <select size="1" name="multiplydivide">
    <option selected value="1">是</option>
    <option value="0">否</option>
    </seltct>
    </p>
    </td>
    <td style="color:#FF6600;">
    <p>
    含余数:
    <select size="1" name="remainder">
    <option selected value="1">是</option>
    <option value="0">否</option>
    </seltct>
    </p>
    </td>
    <td style="color:#FF6600;">
    <p>
    含负数:
    <select size="1" name="minus">
    <option selected value="1">是</option>
    <option value="0">否</option>
    </seltct>
    </p>
    </td>
    <td style="color:#FF6600;">
    <p>
    含括号:
    <select size="1" name="parentheses">
    <option selected value="1">是</option>
    <option value="0">否</option>
    </seltct>
    </p>
    </td>
    </tr>
    <tr>
    <td colspan="5" style="color:#FF6600;">
    请输入数值范围:
    <input type="text" name="min" size="5">-
    <input type="text" name="max" size="5">
                   
    请输入测试题数量:
    <input type="text" name="count" size="8">
    </td>
    </tr>
    <tr>
    <td colspan="5" style="color:#FF6600;">
    <center>
    <input type="submit" value="提交"></input>
    <input type="reset" value="重置"></input>
    </center>
    </td>
    </tr>
    </table>
    </form>
     
   <jsp:useBean id="jisuan" class="MyBean.JavaBean" scope="page"></jsp:useBean>
     
   <jsp:setProperty property="*" name="jisuan"/>
   <form action="JieRes.jsp" method="post">
   <table>
   <% jisuan.Operater(); %>
   <% String shizhi[]=jisuan.getoutoperater();
      double jieguo[]=jisuan.getoutresult();
      int numm=jisuan.getCount();
      int jihao=0;
       
      session.setAttribute("chanshengshi", shizhi);
      session.setAttribute("jieguosession", jieguo);
      session.setAttribute("count", new Integer(numm));
       
      String shurujieguo[]=new String[numm];
       
      for(int i=0;i<jisuan.getCount();i++)
      {
         jihao=1;
         shurujieguo[i]="name";
         shurujieguo[i]=shurujieguo[i]+i;
         BigDecimal   b   =   new   BigDecimal(jieguo[i]); 
         jieguo[i]   =   b.setScale(2,   BigDecimal.ROUND_HALF_UP).doubleValue();
         out.print("<tr><td style='color:#FF6600;'>"+shizhi[i]+"</td>");
   %>
   <td><input type="text" size="4" name=<%= shurujieguo[i] %>></td>
   <%
      out.print("</tr>");
      }
   %>
   </table>
   <%
     if(jihao!=0)
     {
        out.print("<input type='submit' value='提交' align='bottom'>");
     }
   %>
    
    
   </form>
 
   
  </body>
</html>

 

 

JieRes.jsp(结果显示界面):

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
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
     
    <title>My JSP 'JieRes.jsp' starting page</title>
     
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
 
    <style type="text/css">   
     body{   
           background-image: url(img/picture1.jpg);   
           background-repeat: repeat-x;   
         }   
     </style>
 
  </head>
   
  <body background="/img/picture1.jpg">
    <center>
    <table>
    <%
       Integer integer=(Integer)session.getAttribute("count");
       int realnumber=integer.intValue();
       double[] jieguojisuan=(double[])session.getAttribute("jieguosession");
       String[] chanshengshis=(String[])session.getAttribute("chanshengshi");
       //double[] jieguoshuru=(double[])session.getAttribute("shuruzhi");
       String namee[]=new String[realnumber];
        
       for(int i=0;i<realnumber;i++)
       {
          namee[i]="name";
          namee[i]=namee[i]+i;
          //out.println(jieguoshuru[i]);
          String d=request.getParameter(namee[i]);
          double dd=Double.parseDouble(d);
          if(jieguojisuan[i]==dd)
          {
             out.print("<tr><td style='color:#FF6600;'>"+chanshengshis[i]+"</td><td style='color:#FF6600;'>"+jieguojisuan[i]+"</td><td style='color:#FF6600;'>正确</td></tr>");
          }
          else
          {
            out.print("<tr><td style='color:#FF6600;'>"+chanshengshis[i]+"</td><td style='color:#FF6600;'>"+jieguojisuan[i]+"</td><td style='color:#FF6600;'>错误</td></tr>");
          }
       }
     %>
     </table>
     </center>
     <a href="index.jsp" style=color:#FF6600;><center>返回出题界面</center></a>
  </body>
</html>

 

封装数据与逻辑的javabean:

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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
package MyBean;
 
import java.util.Random;
 
public class JavaBean
{
    public String[] outoperater=new String[100];    //存储输出的运算式
    public double[] outresult=new double[100];        //存储输出的运算式的结果
    public int shengchenggeshu=0;        //运算式计数
    public int shengchengshushu=0;       //结果计数
     
    private int properfraction;      //确定是否含有真分数
    private int multiplydivide;      //定义是否有乘除法,0代表没有,1代表有
    private int max, min;            //定义四则运算中的数的取值范围
    private int minus;               //定义是否有负数,0代表没有,1代表有
    private int remainder;           //定义是否有余数,0代表没有,1代表有
    private int parentheses;         //定义是否有括号,0代表没有,1代表有
    private int count;               //定义生成几个运算式
    private int yunSFLen = 0;            //记录运算符长度
 
    //构造函数
    public JavaBean()
    {
        // TODO Auto-generated constructor stub
    }
     
    //对类的所有属性的操作函数
    public void setProperFraction(int properfraction)   //真分数
    {
        this.properfraction=properfraction;
    }
    public int getProperFraction()
    {
        return properfraction;
    }
     
    public void setMultiplyDivide(int multiplydivide)
    {
        this.multiplydivide=multiplydivide;
    }
    public int getMultiplyDivide()
    {
        return multiplydivide;
    }
     
    public void setRemainder(int remainder)
    {
        this.remainder=remainder;
    }
    public int getRemainder()
    {
        return remainder;
    }
     
    public void setMinus(int minus)
    {
        this.minus=minus;
    }
    public int getMinus()
    {
        return minus;
    }
     
    public void setParentheses(int parentheses)
    {
        this.parentheses=parentheses;
    }
    public int getParentheses()
    {
        return parentheses;
    }
     
    public void setMax(int max)
    {
        this.max=max;
    }
    public int getMax()
    {
        return max;
    }
     
    public void setmin(int min)
    {
        this.min=min;
    }
    public int getmin()
    {
        return min;
    }
     
    public void setCount(int count)
    {
        this.count=count;
    }
    public int getCount()
    {
        return count;
    }
     
    public String[] getoutoperater()
    {
        return outoperater;
    }
    public double[] getoutresult()
    {
        return outresult;
    }
     
    //运算式的生成和的计算***************************************************************
 
 
    Random random=new Random();
    //生成四个运算数函数,即多运算数式子中的每个操作数
    public void create_Operand(int A[], int min, int max)
    {
        for (int i = 0; i < 4; i++)
        {
            A[i] = min + random.nextInt(max - min + 1);
        }
    }
 
    //若用户选择不生成除法,则只生成含有加减运算的运算符,用string类型存放运算符,并将括号也存到数组中
    public void create_Operator_JiaJian(String B[], int kuohao)
    {
        for (int i = 0; i < 5; i++)
        {
            B[i] = "a";
        }
        if (1 == kuohao)
        {
            String C[]=new String[3];
            for (int i = 0; i < 3; i++)
            {
                int Judge = random.nextInt(2);
                switch (Judge)
                {
                case 0:
                    C[i] = "+"; break;
                case 1:
                    C[i] = "-"; break;
                }
            }
            int intLeftLocation;
            intLeftLocation = 1 + random.nextInt(2);
            int intRightLocation;
            int a = intLeftLocation + 2;
            intRightLocation = a + random.nextInt(5 - a);
            B[intLeftLocation] = "(";
            B[intRightLocation] = ")";
            int j = 0;
            for (int i = 0; i < 5; i++)
            {
                if ((B[i] != "(") && (B[i] != ")"))
                {
                    B[i] = C[j];
                    j++;
                }
            }
        }
        else
        {
            for (int i = 0; i < 3; i++)
            {
                int Judge = random.nextInt(2);
                switch (Judge)
                {
                case 0:
                    B[i] = "+"; break;
                case 1:
                    B[i] = "-"; break;
                }
            }
        }
    }
 
    //生成加减乘除四则运算的运算符
    public void create_Operator_ChengChu(String B[])
    {
        for (int i = 0; i < 3; i++)
        {
            int Judge = random.nextInt(4);
            switch (Judge)
            {
            case 0:
                B[i] = "+"; break;
            case 1:
                B[i] = "+"; break;
            case 2:
                B[i] = "-"; break;
            case 3:
                B[i] = "÷"; break;
            }
        }
    }
 
    //生成字符数组
    public void MulDivShuZus(String B[])
    {
        for (int i = 0; i < 3; i++)
        {
            create_Operator_ChengChu(B);
        }
        if ((B[0] == "÷") && (B[1] == "÷") && (B[2] == "÷"))  //规定不能有连续的3个除法
        {
            int intJudge = 1 + random.nextInt(2);
            switch (intJudge)
            {
            case 1:
                B[2] = "+";
                break;
            case 2:
                B[2] = "-";
                break;
            }
        }
    }
 
    //判断分数中的分子分母是否合法,即分子的绝对值是否小于分母
    public void judge_Fraction(int fenzi[], int fenmu[], int max)
    {
        if ((fenzi[0]<0) && (((fenzi[0])*(-1))>max))
        {
            int temp = (-1)*fenzi[0];
            fenzi[0] = fenmu[0];
            fenmu[0] = temp*(-1);
        }
 
        //为保证分数相加相减后仍然是真分数,将分子设为小于二分之分母的整数
        if (fenzi[0] <= 0)
        {
            if (fenzi[0]*(-1)>(max / 2))
            {
                fenzi[0] = fenzi[0] / 2;
            }
        }
        if (fenzi[0]>0)
        {
            if (fenzi[0]>(max / 2))
            {
                fenzi[0] = fenzi[0] / 2;
            }
        }
    }
 
    //求分子和分母的最大公约数,以便将分子分母化简到最简
    public int great_common_Divisor(int fenzi, int fenmu)
    {
        int original_fenzi = fenzi;
        int original_fenmu = fenmu;
        int remainder = fenzi%fenmu;
        while (remainder != 0)
        {
            int temp = fenmu;
            fenmu = fenzi%fenmu;
            fenzi = temp;
            remainder = fenzi%fenmu;
        }
        return fenmu;
    }
 
    //计算加减运算式的值,返回一个result值
    public double calculate_Jiajian(int A[], String B[], int kuohao, int minus, int min, int max)
    {
        if (1 == minus)
        {
            double result = A[0];
            if (1 == kuohao)
            {
                result = 0;
                if ((B[1] == "(") && (B[3] == ")"))
                {
                    if (B[2] == "+")
                    {
                        result = A[1] + A[2];
                    }
                    else
                    {
                        result = A[1] - A[2];
                    }
                    if (B[0] == "+")
                    {
                        result = result + A[0];
                    }
                    else
                    {
                        result = A[0] - result;
                    }
                    if (B[4] == "+")
                    {
                        result = result + A[3];
                    }
                    else
                    {
                        result = result - A[3];
                    }
                }
                if ((B[2] == "(") && (B[4] == ")"))
                {
                    double result1 = 0;
                    if (B[3] == "+")
                    {
                        result = A[2] + A[3];
                    }
                    else
                    {
                        result = A[2] - A[3];
                    }
                    if (B[0] == "+")
                    {
                        result1 = A[0] + A[1];
                    }
                    else
                    {
                        result1 = A[0] - A[1];
                    }
                    if (B[1] == "+")
                    {
                        result = result + result1;
                    }
                    else
                    {
                        result = result1 - result;
                    }
                }
                if ((B[1] == "(") && (B[4] == ")"))
                {
                    if (B[2] == "+")
                    {
                        result = A[1] + A[2];
                    }
                    else
                    {
                        result = A[1] - A[2];
                    }
                    if (B[3] == "+")
                    {
                        result = result + A[3];
                    }
                    else
                    {
                        result = result - A[3];
                    }
                    if (B[0] == "+")
                    {
                        result = result + A[0];
                    }
                    else
                    {
                        result = A[0] - result;
                    }
                }
                return result;
            }
            else
            {
                for (int i = 0; i < 3; i++)
                {
                    if (B[i] == "+")
                    {
                        result = result + A[i + 1];
                    }
                    else
                    {
                        result = result - A[i + 1];
                    }
                }
                return result;
            }
        }
        else
        {
            double result = A[0];
            if (1 == kuohao)
            {
                double result1=0;
                if ((B[1] == "(") && (B[3] == ")"))
                {
                    if (B[2] == "+")
                    {
                        result1 = A[1] + A[2];
                    }
                    else
                    {
                        if (A[1] > A[2])
                        {
                            result1 = A[1] - A[2];
                        }
                        else
                        {
                            A[1] = max;
                            result1 = A[1] - A[2];
                        }
                    }
                    if (B[0] == "+")
                    {
                        result1 = result1 + A[0];
                    }
                    else
                    {
                        if (A[0] > result1)
                        {
                            result1 = A[0] - result1;
                        }
                        else
                        {
                            B[0] = "+";
                            result1 = result1 + A[0];
                        }
                    }
                    if (B[4] == "+")
                    {
                        result1 = result1 + A[3];
                    }
                    else
                    {
                        if (result1 > A[3])
                        {
                            result1 = result1 - A[3];
                        }
                        else
                        {
                            A[3] = (int) (result1 / 2);
                            result1 = result1 - A[3];
                        }
                    }
                }
                if ((B[2] == "(") && (B[4] == ")"))
                {
                    double result11 = 0;
                    if (B[3] == "+")
                    {
                        result11 = A[2] + A[3];
                    }
                    else
                    {
                        if (A[2] > A[3])
                        {
                            result11 = A[2] - A[3];
                        }
                        else
                        {
                            A[2] = max;
                            result11 = A[2] - A[3];
                        }
                    }
                    if (B[0] == "+")
                    {
                        result11 = A[0] + A[1];
                    }
                    else
                    {
                        if (A[0] > A[1])
                        {
                            result11 = A[0] - A[1];
                        }
                        else
                        {
                            A[0] = max;
                            result11 = A[0] - A[1];
                        }
                    }
                    if (B[1] == "+")
                    {
                        result11 = result11 + result11;
                    }
                    else
                    {
                        if (result11 > result11)
                        {
                            result11 = result11 - result11;
                        }
                        else
                        {
                            B[1] = "+";
                            result11 = result11 + result11;
                        }
                    }
                }
                if ((B[1] == "(") && (B[4] == ")"))
                {
                    if (B[2] == "+")
                    {
                        result1 = A[1] + A[2];
                    }
                    else
                    {
                        if (A[1] > A[2])
                        {
                            result1 = A[1] - A[2];
                        }
                        else
                        {
                            A[1] = max;
                            result1 = A[1] - A[2];
                        }
                    }
                    if (B[3] == "+")
                    {
                        result1 = result1 + A[3];
                    }
                    else
                    {
                        if (result1 > A[3])
                        {
                            result1 = result1 - A[3];
                        }
                        else
                        {
                            B[3] = "+";
                            result1 = result1 + A[3];
                        }
                    }
                    if (B[0] == "+")
                    {
                        result1 = result1 + A[0];
                    }
                    else
                    {
                        if (A[0] > result1)
                        {
                            result1 = A[0] - result1;
                        }
                        else
                        {
                            B[0] = "+";
                            result1 = result1 + A[0];
                        }
                    }
                }
                return result1;
            }
            else
            {
                for (int i = 0; i < 3; i++)
                {
                    if (B[i] == "+")
                    {
                        result = result + A[i + 1];
                    }
                    else
                    {
                        if (result>A[i + 1])
                        {
                            result = result - A[i + 1];
                        }
                        else
                        {
                            B[i] = "+";
                            result = result + A[i + 1];
                        }
                    }
                }
                return result;
            }
        }
    }
 
    //输出分数,并计算分数的值并且判断用户的计算是否正确
    public int calculate_ProperFraction(int A[], int B[], int i, int min, int max, int print)
    {
        int maxi[]=new int[1];
        maxi[0]=max;
        int mini[]=new int[1];
        mini[0]=min;
        int AA[]=new int[1];
        AA[0]=A[i];
        int BB[]=new int[1];
        BB[0]=B[i];
         
        judge_Fraction(AA, maxi, max);
        judge_Fraction(BB, maxi, max);
        int divisor1 = great_common_Divisor(A[i], max);
        int divisor2 = great_common_Divisor(B[i], max);
        int inputfenzi, inputfenmu;
        int suanfu = random.nextInt(4);
        switch (suanfu)
        {
        case 0:
        {
                      //cout << "请计算该分数算式(结果输入格式:分子 空格 分母):";
                      //cout << A[i] / divisor1 << "/" << max / divisor1 << " + " << B[i] / divisor2 << "/" << max / divisor2 << " = " << endl;
             double a,b,c,d;
             a=A[i] / divisor1;
             b=max / divisor1;
             c=B[i] / divisor2;
             d=max / divisor2;
            outoperater[shengchenggeshu]=""+a+"/"+b+"+"+c+"/"+d+"=";
            shengchenggeshu=shengchenggeshu+1;
            outresult[shengchengshushu]=a/b+c/d;
            shengchengshushu=shengchengshushu+1;
                  break;
        }
        case 1:
        {
 
                     //cout << "请计算该分数算式(结果输入格式:分子 空格 分母):";
                     //cout << A[i] / divisor1 << "/" << max / divisor1 << " - " << B[i] / divisor2 << "/" << max / divisor2 << " = " << endl;
             double a,b,c,d;
             a=A[i] / divisor1;
             b=max / divisor1;
             c=B[i] / divisor2;
             d=max / divisor2;
            outoperater[shengchenggeshu]=""+a+"/"+b+"-"+c+"/"+d+"=";
            shengchenggeshu=shengchenggeshu+1;
            outresult[shengchengshushu]=a/b-c/d;
            shengchengshushu=shengchengshushu+1;
                  break;
        }
        case 2:
        {
                      //cout << "请计算该分数算式(结果输入格式:分子 空格 分母):";
                     // cout << A[i] / divisor1 << "/" << max / divisor1 << " x " << B[i] / divisor2 << "/" << max / divisor2 << " = " << endl;
                         double a,b,c,d;
                         a=A[i] / divisor1;
                         b=max / divisor1;
                         c=B[i] / divisor2;
                         d=max / divisor2;
                        outoperater[shengchenggeshu]=""+a+"/"+b+"×"+c+"/"+d+"=";
                        shengchenggeshu=shengchenggeshu+1
                        outresult[shengchengshushu]=(a/b)*(c/d);
                        shengchengshushu=shengchengshushu+1;
                  break;
        }
        case 3:
        {
                      //cout << "请计算该分数算式(结果输入格式:分子 空格 分母):";
                      //cout << B[i] / divisor2 << "/" << max / divisor2 << " ÷ " << A[i] / divisor1 << "/" << max / divisor1 << " = " << endl;
                         double a,b,c,d;
                         a=A[i] / divisor1;
                         b=max / divisor1;
                         c=B[i] / divisor2;
                         d=max / divisor2;
                         if((c/d)==0)
                         {
                             c=c+1;
                         }
                        outoperater[shengchenggeshu]=""+a+"/"+b+"÷"+c+"/"+d+"=";
                        shengchenggeshu=shengchenggeshu+1;
                        outresult[shengchengshushu]=(a/b)/(c/d);
                        shengchengshushu=shengchengshushu+1;
                  break;
        }
        }
        return 0;
    }
 
    //输出加减四则运算式,一种方式为输出到屏幕,另一种方式为输出到文件
    public void output_JiaJian(int A[], String B[], int kuohao, int print)
    {
 
            if (1 == kuohao)
            {
                if ((B[1] == "(") && (B[3] == ")"))
                {
                    //cout << A[0] << " " << B[0] << " " << B[1] << " " << A[1] << " " << B[2] << " " << A[2] << " " << B[3] << " " << B[4] << " " << A[3] << " = " << endl;
                    outoperater[shengchenggeshu]=""+A[0]+B[0]+B[1]+A[1]+B[2]+A[2]+B[3]+B[4]+A[3]+"=";
                    shengchenggeshu=shengchenggeshu+1;
                }
                if ((B[2] == "(") && (B[4] == ")"))
                {
                    //cout << A[0] << " " << B[0] << " " << A[1] << " " << B[1] << " " << B[2] << " " << A[2] << " " << B[3] << " " << A[3] << " " << B[4] << " " << " = " << endl;
                    outoperater[shengchenggeshu]=""+A[0]+B[0]+A[1]+B[1]+B[2]+A[2]+B[3]+A[3]+B[4]+"=";
                    shengchenggeshu=shengchenggeshu+1;
                }
                if ((B[1] == "(") && (B[4] == ")"))
                {
                    //cout << A[0] << " " << B[0] << " " << B[1] << " " << A[1] << " " << B[2] << " " << A[2] << " " << B[3] << " " << A[3] << " " << B[4] << " " << " = " << endl;
                    outoperater[shengchenggeshu]=""+A[0]+B[0]+B[1]+A[1]+B[2]+A[2]+B[3]+A[3]+B[4]+"=";
                    shengchenggeshu=shengchenggeshu+1;
                }
            }
            else
            {
                for (int i = 0; i < 3; i++)
                {
                    //cout << A[i] << " " << B[i] << " ";
                    outoperater[shengchenggeshu]=""+A[i]+B[i];
                     
                }
                //cout << A[3] << " = " << endl;
                outoperater[shengchenggeshu]=""+A[3]+"=";
                shengchenggeshu=shengchenggeshu+1;
            }
             
    }
 
    //判断用户输入的结果是否正确,给出相应的提示
    public void minus_JiaJian(int A[], String B[], int min, int max, int minus, int kuohao, int print)
    {
        create_Operand(A, min, max);
        create_Operator_JiaJian(B, kuohao);
        double calculateResult = calculate_Jiajian(A, B, kuohao, minus, min, max);
        outresult[shengchengshushu]=calculateResult;
        shengchengshushu=shengchengshushu+1;
        output_JiaJian(A, B, kuohao, print);
    }
 
    //生成运算符数组
    public int YSShuZus(String B[], int kuohao)
    {
        int intYunSFNum;
        if (0 == kuohao)   //如果没有括号
        {
            MulDivShuZus(B);
            intYunSFNum = 3;
        }
        else  //如果有括号
        {
            MulDivShuZus(B);    //获得没有括号的运算符数组
            String chLinShi[]=new String[3];   //临时数组
            for (int i = 0; i < 3; i++)
            {
                chLinShi[i] = B[i];
            }
            intYunSFNum = 3;
            int intRealstring[]=new int[3];
            for (int i = 0; i < 3; i++)   //将运算符按优先级存储起来
            {
                if (B[i] == "+" || B[i] == "-")
                {
                    intRealstring[i] = 1;
                }
                else
                {
                    intRealstring[i] = 2;
                }
            }
 
            for (int i = 0; i < 2; i++)
            {
                if (chLinShi[0] == "÷")
                {
                    if (chLinShi[1] == "÷")
                    {
                        intYunSFNum = 5;
                        B[0] = "(";
                        B[1] = chLinShi[0];
                        B[2] = ")";
                        B[3] = chLinShi[1];
                        B[4] = chLinShi[2];
                        break;
                    }
 
                }
                if (intRealstring[i]<intRealstring[i + 1])
                {
                    if (i == 0)
                    {
                        if (chLinShi[i + 1] == "÷")
                        {
                            if (chLinShi[i + 2] == "÷")
                            {
                                intYunSFNum = 7;
                                B[0] = "(";
                                B[1] = "(";
                                B[2] = chLinShi[0];
                                B[3] = ")";
                                B[4] = chLinShi[1];
                                B[5] = ")";
                                B[6] = chLinShi[2];
                            }
                            else
                            {
                                intYunSFNum = 5;
                                B[0] = "(";
                                B[1] = chLinShi[0];
                                B[2] = ")";
                                B[3] = chLinShi[1];
                                B[4] = chLinShi[2];
                            }
                        }
                        else
                        {
                            intYunSFNum = 5;
                            B[0] = "(";
                            B[1] = chLinShi[0];
                            B[2] = ")";
                            B[3] = chLinShi[1];
                            B[4] = chLinShi[2];
                        }
                    }
                    else
                    {
                        intYunSFNum = 5;
                        B[0] = chLinShi[0];
                        B[1] = "(";
                        B[2] = chLinShi[1];
                        B[3] = ")";
                        B[4] = chLinShi[2];
                    }
                }
            }
        }
        return intYunSFNum;
    }
 
    //
 
    //生成两个存储数据的数组,主函数中的作用是用来进行判断是进行两位真分数的判断还是多位整数的四则运算
    public void createArray(int A[], int B[], int count, int min, int max)
    {
        for (int i = 0; i < count; i++)
        {
 
            A[i] = min + random.nextInt(max - min + 1);
            B[i] = min + random.nextInt(max - min + 1);
 
            for (int j = 0; j < i; j++)
            {
                if (A[i] == A[j])
                {
                    A[i] = min + random.nextInt(max - min + 1);
                    j = -1;    //通过设置j,对新生成的数A[i],使其和前面的所有数进行比较,此循环重复
                }
            }
            for (int j = 0; j < i; j++)
            {
                if (B[i] == B[j])
                {
                    B[i] = min + random.nextInt(max - min + 1);
                    j = -1;
                }
            }
        }
    }
 
    //生成加减运算符
    public void AddRedu(String stringArry[])
    {
        int intJudge;      //此变量分别以1,2,3,4代表+、-、×、÷
 
        intJudge = 1 +  random.nextInt(2);
        switch (intJudge)
        {
        case 1:
        {
                  stringArry[0] = "+";
                  break;
        }
        case 2:
        {
                  stringArry[0] = "-";
                  break;
        }
        }
    }
 
    //生成乘除运算符
    public void MulDiv(String stringArry[])
    {
        int intJudge;      //此变量分别以1,2,3,4代表+、-、×、÷
 
        intJudge = 1 + random.nextInt(4);
        switch (intJudge)
        {
        case 1:
        {
                  stringArry[0] = "+";
                  break;
        }
        case 2:
        {
                  stringArry[0] = "-";
                  break;
        }
        case 3:
        {
                  stringArry[0] = "×";
                  break;
        }
        case 4:
        {
                  stringArry[0] = "÷";
                  break;
        }
        }
    }
 
    //判断乘除号,生成字符数组
    public void MulDivShuZu(String stringMDYSF[], int intMulDiv)
    {    
        if (intMulDiv == 0)          //如果没有乘除法
        {
            int intJudge;      //此变量分别以1,2,3,4代表+、-、×、÷
            for (int i = 0; i < 3; i++)
            {
                intJudge = 1 +  random.nextInt(2);
                switch (intJudge)
                {
                case 1:
                {
                    stringMDYSF[i] = "+";
                    break;
                }
                case 2:
                {
                    stringMDYSF[i] = "-";
                    break;
                }
                }
            }
        }
        else                        //如果有乘除法
        {
            int intJudge;      //此变量分别以1,2,3,4代表+、-、×、÷
            for (int i = 0; i < 3; i++)
            {
                intJudge = 1 + random.nextInt(4);
                switch (intJudge)
                {
                case 1:
                {
                    stringMDYSF[i] = "+";
                          break;
                }
                case 2:
                {
                    stringMDYSF[i] = "-";
                          break;
                }
                case 3:
                {
                    stringMDYSF[i] = "×";
                          break;
                }
                case 4:
                {
                    stringMDYSF[i] = "÷";
                          break;
                }
                }
            }
 
            for (int i = 0; i < 3; i++)    //不能有连续的3个除法
            {
                if (stringMDYSF[i] == "÷")
                {
                    if (stringMDYSF[i + 1] == "÷" && stringMDYSF[i + 2] == "÷")
                    {
                        intJudge = 1 +  random.nextInt(2);
                        switch (intJudge)
                        {
                        case 1:
                        {
                            stringMDYSF[i] = "+";
                            break;
                        }
                        case 2:
                        {
                            stringMDYSF[i] = "-";
                            break;
                        }
                        }
                    }
                }
            }
 
        }
    }
 
    //生成运算符数组
    public void YSShuZu(String stringYunSF[], int intMulDiv, int intKuoHao, int intYunSFNum[])
    {
        if (0 == intKuoHao)   //如果没有括号
        {
            MulDivShuZu(stringYunSF, intMulDiv);
            intYunSFNum[0] = 3;
        }
        else  //如果有括号
        {
            MulDivShuZu(stringYunSF, intMulDiv);    //获得没有括号的运算符数组
 
            String chLinShi[]=new String[3];   //临时数组
            for (int i = 0; i < 3; i++)
            {
                chLinShi[i] = stringYunSF[i];
            }
 
            if (0 == intMulDiv)     //如果没有乘除,只有加减,加上括号
            {
                int intKHaoNum;
                intKHaoNum = 1;
 
                if (1 == intKHaoNum)    //加一个括号
                {
                    intYunSFNum[0] = 5;    //运算符的个数为5个
                    int intLeftLocation;
                    intLeftLocation = 1 + random.nextInt(2);
                    int intRightLocation;
                    int a = intLeftLocation + 2;
                    intRightLocation = a + random.nextInt(5 - a);
 
                    stringYunSF[intLeftLocation] = "(";
                    stringYunSF[intRightLocation] = ")";
 
                    int j = 0;
                    for (int i = 0; i < 5; i++)
                    {
                        if ((stringYunSF[i] != "(") && (stringYunSF[i] != ")"))
                        {
                            stringYunSF[i] = chLinShi[j];
                            j++;
                        }
                    }
 
 
                }
                /*  用于判断生成几个括号时使用此功能
                else   //加两个括号
                {
                    intYunSFNum = 7;     //运算符个数为7个
                    stringYunSF[0] = "(";
                    stringYunSF[1] = chLinShi[0];
                    stringYunSF[2] = ")";
                    stringYunSF[3] = chLinShi[1];
                    stringYunSF[4] = "(";
                    stringYunSF[5] = chLinShi[2];
                    stringYunSF[6] = ")";
                }*/
            }
            else   //如果有乘除,加上括号
            {
                intYunSFNum[0] = 3;
 
                int intRealstring[]=new int[3];
                for (int i = 0; i < 3; i++)   //将运算符按优先级存储起来
                {
                    if (stringYunSF[i] == "+" || stringYunSF[i] == "-")
                    {
                        intRealstring[i] = 1;
                    }
                    else
                    {
                        intRealstring[i] = 2;
                    }
                }
 
                for (int i = 0; i < 2; i++)
                {
                    if (chLinShi[0] == "÷")
                    {
                        if (chLinShi[1] == "÷")
                        {
                            intYunSFNum[0] = 5;
                            stringYunSF[0] = "(";
                            stringYunSF[1] = chLinShi[0];
                            stringYunSF[2] = ")";
                            stringYunSF[3] = chLinShi[1];
                            stringYunSF[4] = chLinShi[2];
                            break;
                        }
 
                    }
                    if (intRealstring[i]<intRealstring[i + 1])
                    {
                        if (i == 0)
                        {
                            if (chLinShi[i + 1] == "÷")
                            {
                                if (chLinShi[i + 2] == "÷")
                                {
                                    intYunSFNum[0] = 7;
                                    stringYunSF[0] = "(";
                                    stringYunSF[1] = "(";
                                    stringYunSF[2] = chLinShi[0];
                                    stringYunSF[3] = ")";
                                    stringYunSF[4] = chLinShi[1];
                                    stringYunSF[5] = ")";
                                    stringYunSF[6] = chLinShi[2];
                                }
                                else
                                {
                                    intYunSFNum[0] = 5;
                                    stringYunSF[0] = "(";
                                    stringYunSF[1] = chLinShi[0];
                                    stringYunSF[2] = ")";
                                    stringYunSF[3] = chLinShi[1];
                                    stringYunSF[4] = chLinShi[2];
                                }
                            }
                            else
                            {
                                intYunSFNum[0] = 5;
                                stringYunSF[0] = "(";
                                stringYunSF[1] = chLinShi[0];
                                stringYunSF[2] = ")";
                                stringYunSF[3] = chLinShi[1];
                                stringYunSF[4] = chLinShi[2];
                            }
                        }
                        else
                        {
                            intYunSFNum[0] = 5;
                            stringYunSF[0] = chLinShi[0];
                            stringYunSF[1] = "(";
                            stringYunSF[2] = chLinShi[1];
                            stringYunSF[3] = ")";
                            stringYunSF[4] = chLinShi[2];
                        }
                    }
                }
 
            }
        }
 
 
    }
 
    //函数实现有无余数
    public void RemainderFouction(int intNum[], String stringYunSuanFu[], int intYunSuanFNu[])
    {
 
        //包括括号和乘除法的区分
        //首先实现对乘除法有无余数的判断
        //其次加入括号,判断括号内的乘除法有无余数的实现
 
        //对运算符数组循环寻找括号和乘除号
        int intCycleNum = 0;
        int intParentNum = 0;
        for (intCycleNum = 0; intCycleNum < intYunSuanFNu[0]; intCycleNum++)
        {
            if ((stringYunSuanFu[intCycleNum] == "(") || (stringYunSuanFu[intCycleNum] == ")"))
            {
                intParentNum += 1;
            }
 
            if (stringYunSuanFu[intCycleNum] == "÷")
            {
                if (intNum[intCycleNum + 1 - intParentNum] == 0)
                {
                    intNum[intCycleNum + 1 - intParentNum] = 1 + random.nextInt(10);
                }
 
                if (intCycleNum != 0 && stringYunSuanFu[intCycleNum - 1] == ")")    //此IF语句是测试(a+b)÷c的情况
                {
                    int num;
                    num = intCycleNum - intParentNum;     //标识没有括号的字符数组中除号的位置
 
                    int intSum;   //括号内的数的运算结果
                    int intLeft;  //括号内参与运算的左边的数
                    int intRight;  //括号内参与运算的右边的数
                    String strYunSF;
                    intLeft = intNum[num - 1];
                    intRight = intNum[num];
                    strYunSF = stringYunSuanFu[intCycleNum - 2];
                    if (strYunSF == "+")
                    {
                        intSum = intLeft + intRight;
                    }
                    else if (strYunSF == "-")
                    {
                        intSum = intLeft - intRight;
                        if (intSum < 0)
                        {
                            intNum[num - 1] = intRight;
                            intNum[num] = intLeft;
                            intSum = intRight - intLeft;
                        }
 
                    }
                    else if (strYunSF == "×")
                    {
                        intSum = intLeft * intRight;
                    }
                    else
                    {
                        intSum = intLeft / intRight;
                    }
 
                    if (intSum < 0)
                    {
                        int a;
                        a = intNum[num];
                        intNum[num] = intNum[num + 1];
                        intNum[num + 1] = intNum[num];
                        intSum = intNum[num] - intNum[num + 1];
                    }
 
                    int intYushu;    //余数
                    intYushu = intSum % (intNum[num + 1]);   //除号两边的数求商
                    if (intYushu != 0)
                    {
                        if (intSum == 1)
                        {
                            intNum[num + 1] = 1;
                        }
                        else
                        {
                            int j = intSum - 1;
                            for (int i = 0; i < intSum; i++)
                            {
                                intYushu = intSum%j;
                                if (intYushu == 0)
                                {
                                    intNum[num + 1] = j;
                                    break;
                                }
                                j--;
                            }
                        }
 
                    }
 
                    //下面是(a+b)÷c÷d的情况
                    if (stringYunSuanFu[intCycleNum + 1] == "÷")
                    {
                        int intOneResult;         //intOneReslut=(a+b)÷c
                        intOneResult = intSum / intNum[num + 1];
                        int intSecResult;         //intSecResult=(a+b)÷c÷d
                        if (intNum[num + 2] == 0)
                        {
                            intNum[num + 2] = 1 + random.nextInt(10);
                        }
                        intSecResult = intOneResult % (intNum[num + 2]);
 
                        if (intSecResult != 0)
                        {
                            if (intOneResult == 1)
                            {
                                intNum[num + 2] = 1;
                            }
                            else
                            {
                                int intSecYue;
                                intSecYue = intOneResult - 1;
 
                                for (int i = 0; i < intOneResult; i++)
                                {
                                    intSecResult = intOneResult%intSecYue;
                                    if (intSecResult == 0)
                                    {
                                        intNum[num + 2] = intSecYue;
                                        break;
                                    }
                                    intSecYue--;
                                }
                            }
 
                        }
 
                    }
 
                }
                else   //a÷b的情况
                {
                    int num;
                    num = intCycleNum - intParentNum;
 
                    int YuShu;
                    if (intNum[num + 1] == 0)
                    {
                        intNum[num + 1] = 1 + random.nextInt(10);
                    }
                    YuShu = (intNum[num]) % (intNum[num + 1]);
                    if (YuShu != 0)
                    {
                        if (intNum[num] == 1)
                        {
                            intNum[num + 1] = 1;
                        }
                        else
                        {
                            int j = intNum[num] - 1;
                            for (int i = 0; i < intNum[num]; i++)
                            {
                                YuShu = intNum[num] % j;
                                if (YuShu == 0)
                                {
                                    intNum[num + 1] = j;
                                    break;
                                }
                                j--;
                            }
                        }
 
                    }
 
                    //下面是a÷b÷c的情况
                    if (stringYunSuanFu[intCycleNum + 1] == "÷")
                    {
                        int OneRes;
                        OneRes = intNum[num] % intNum[num + 1];
                        if (OneRes != 0)
                        {
                            int j;
                            j = intNum[num] - 1;
                            for (int i = 0; i < intNum[num]; i++)
                            {
                                OneRes = intNum[num] % j;
                                if (OneRes == 0)
                                {
                                    intNum[num + 1] = j;
                                    break;
                                }
                                j--;
                            }
                        }
                        OneRes = intNum[num] / intNum[num + 1];
                        int yushus;
                        if (intNum[num + 2] == 0)
                        {
                            intNum[num + 2] = 1 + random.nextInt(10);
                        }
                        yushus = OneRes % (intNum[num + 2]);
                        if (yushus != 0)
                        {
                            if (OneRes == 1)
                            {
                                intNum[num + 2] = 1;
                            }
                            else
                            {
                                int yueshu;
                                yueshu = OneRes - 1;
                                for (int i = 0; i < OneRes; i++)
                                {
                                    yushus = OneRes%yueshu;
                                    if (yushus == 0)
                                    {
                                        intNum[num + 2] = yueshu;
                                        break;
                                    }
                                    yueshu--;
                                }
                            }
 
                        }
                    }
                }
            }
 
        }
 
        //
        if (stringYunSuanFu[0] == "÷" && stringYunSuanFu[1] == "(" && stringYunSuanFu[3] == ")")         //a÷(b+c)
        {
            int intTemps;
            if (stringYunSuanFu[2] == "+")
            {
                intTemps = intNum[1] + intNum[2];
                int yushuab;
                yushuab = intNum[0] % intTemps;
                if (yushuab != 0)
                {
                    intNum[0] = 2 * intTemps;
                }
                //cout << "yueshu=" << yushuab << " ";
                //cout << "第一种情况:" << "intTemps=" << intTemps << " " << "intNum[0]=" << intNum[0] << endl;
            }
            if (stringYunSuanFu[2] == "-")
            {
                intTemps = intNum[1] - intNum[2];
                if (intTemps < 0)
                {
                    int aaa;
                    aaa = intNum[1];
                    intNum[1] = intNum[2];
                    intNum[2] = aaa;
 
                    intTemps = intNum[1] - intNum[2];
                }
                if (intTemps == 0)
                {
                    intNum[2] = 1 + random.nextInt(10);
                    intNum[1] = intNum[2] + random.nextInt(3);
                    intTemps = intNum[1] - intNum[2];
                }
                int yushua;
                yushua = intNum[0] % intTemps;
                if (yushua != 0)
                {
                    intNum[0] = 2 * intTemps;
                }
 
                //cout << "yueshu=" << yushua << " ";
                //cout << "第二种情况:" << "intTemps=" << intTemps << " " << "intNum[0]=" << intNum[0] << endl;
            }
 
        }
    }
 
    //含有乘除法的计算
    public double OperatorMD(int intYunSuanShu[], String strYunSuanFu[], int YunSuanfuN[])
    {
        double jieguo = 0;
 
        if ((strYunSuanFu[0] == "(") && (strYunSuanFu[1] == "("))
        {
            double jieguo1;
            if (strYunSuanFu[2] == "+")
            {
                jieguo = (intYunSuanShu[0] + intYunSuanShu[1]) / intYunSuanShu[2] / intYunSuanShu[3];
            }
            else
            {
                jieguo = (intYunSuanShu[0] - intYunSuanShu[1]) / intYunSuanShu[2] / intYunSuanShu[3];
            }
        }
        if (strYunSuanFu[0] == "(")
        {
            double jieguo1;
            if (strYunSuanFu[1] == "+")
            {
                jieguo1 = intYunSuanShu[0] + intYunSuanShu[1];
            }
            else if (strYunSuanFu[1] == "-")
            {
                jieguo1 = intYunSuanShu[0] - intYunSuanShu[1];
            }
            else
            {
                jieguo1 = intYunSuanShu[0] / intYunSuanShu[1];
            }
 
            if (strYunSuanFu[3] == "×")
            {
                jieguo1 = jieguo1*intYunSuanShu[2];
            }
            else
            {
                jieguo1 = jieguo1 / intYunSuanShu[2];
            }
 
            if (strYunSuanFu[4] == "+")
            {
                jieguo = jieguo1 + intYunSuanShu[3];
            }
            else if (strYunSuanFu[4] == "-")
            {
                jieguo = jieguo1 - intYunSuanShu[3];
            }
            else if (strYunSuanFu[4] == "×")
            {
                jieguo = jieguo1 * intYunSuanShu[3];
            }
            else
            {
                jieguo = jieguo1 / intYunSuanShu[3];
            }
        }
 
        if (strYunSuanFu[1] == "(" && strYunSuanFu[0] != "(")
        {
            int jieguo1;
            if (strYunSuanFu[2] == "+")
            {
                if (strYunSuanFu[0] == "+")
                {
                    if (strYunSuanFu[4] == "×")
                    {
                        jieguo = intYunSuanShu[0] + (intYunSuanShu[1] + intYunSuanShu[2])*intYunSuanShu[3];
                        //cout << "+(+)*" << endl;
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] + (intYunSuanShu[1] + intYunSuanShu[2]) / intYunSuanShu[3];
                        //cout << "+(+)/" << endl;
                    }
                }
                if (strYunSuanFu[0] == "-")
                {
                    if (strYunSuanFu[4] == "×")
                    {
                        jieguo = intYunSuanShu[0] - (intYunSuanShu[1] + intYunSuanShu[2])*intYunSuanShu[3];
                        //cout << "-(+)*" << endl;
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] - (intYunSuanShu[1] + intYunSuanShu[2]) / intYunSuanShu[3];
                        //cout << "-(+)/" << endl;
                    }
                }
                if (strYunSuanFu[0] == "×")
                {
                    if (strYunSuanFu[4] == "×")
                    {
                        jieguo = intYunSuanShu[0] * (intYunSuanShu[1] + intYunSuanShu[2])*intYunSuanShu[3];
                        //cout << "*(+)*" << endl;
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] * (intYunSuanShu[1] + intYunSuanShu[2]) / intYunSuanShu[3];
                        //cout << "*(+)/" << endl;
                    }
                }
                if (strYunSuanFu[0] == "÷")
                {
                    if (strYunSuanFu[4] == "×")
                    {
                        jieguo = intYunSuanShu[0] / (intYunSuanShu[1] + intYunSuanShu[2])*intYunSuanShu[3];
                        //cout << "/(+)*" << endl;
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] / (intYunSuanShu[1] + intYunSuanShu[2]) / intYunSuanShu[3];
                        //cout << "/(+)/" << endl;
                    }
                }
            }
            else
            {
                if (strYunSuanFu[0] == "+")
                {
                    if (strYunSuanFu[4] == "×")
                    {
                        jieguo = intYunSuanShu[0] + (intYunSuanShu[1] - intYunSuanShu[2])*intYunSuanShu[3];
                        //cout << "+(-)*" << endl;
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] + (intYunSuanShu[1] - intYunSuanShu[2]) / intYunSuanShu[3];
                        //cout << "+(-)/" << endl;
                    }
                }
                if (strYunSuanFu[0] == "-")
                {
                    if (strYunSuanFu[4] == "×")
                    {
                        jieguo = intYunSuanShu[0] - (intYunSuanShu[1] - intYunSuanShu[2])*intYunSuanShu[3];
                        //cout << "-(-)*" << endl;
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] - (intYunSuanShu[1] - intYunSuanShu[2]) / intYunSuanShu[3];
                        //cout << "-(-)*" << endl;
                    }
                }
                if (strYunSuanFu[0] == "×")
                {
                    if (strYunSuanFu[4] == "×")
                    {
                        jieguo = intYunSuanShu[0] * (intYunSuanShu[1] - intYunSuanShu[2])*intYunSuanShu[3];
                        //cout << "*(-)*" << endl;
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] * (intYunSuanShu[1] - intYunSuanShu[2]) / intYunSuanShu[3];
                        //cout << "*(-)/" << endl;
                    }
                }
                if (strYunSuanFu[0] == "÷")
                {
                    if (strYunSuanFu[4] == "×")
                    {
                        int ab = intYunSuanShu[1] - intYunSuanShu[2];
                        if (ab == 0)
                        {
                            intYunSuanShu[1] = 8;
                            intYunSuanShu[2] = 7 - random.nextInt(4);
                        }
                        jieguo = intYunSuanShu[0] / (intYunSuanShu[1] - intYunSuanShu[2])*intYunSuanShu[3];
                        //cout << "/(-)*" << endl;
                    }
                    else
                    {
                        int ab = intYunSuanShu[1] - intYunSuanShu[2];
                        if (ab == 0)
                        {
                            intYunSuanShu[1] = 8;
                            intYunSuanShu[2] = 7 - random.nextInt(4);
                        }
                        jieguo = intYunSuanShu[0] / (intYunSuanShu[1] - intYunSuanShu[2]) / intYunSuanShu[3];
                        //cout << "/(-)/" << endl;
                    }
                }
            }
 
        }
        if ((strYunSuanFu[0] != "(") && (strYunSuanFu[1] != "("))
        {
            int jieguo1;
            if (strYunSuanFu[0] == "+")
            {
                if (strYunSuanFu[1] == "+")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] + intYunSuanShu[1] + intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] + intYunSuanShu[1] + intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
                else
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] + intYunSuanShu[1] - intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] + intYunSuanShu[1] - intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
            }
            if (strYunSuanFu[0] == "-")
            {
                if (strYunSuanFu[1] == "+")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] - intYunSuanShu[1] + intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] - intYunSuanShu[1] + intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
                if (strYunSuanFu[1] == "-")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] - intYunSuanShu[1] - intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] - intYunSuanShu[1] - intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
                if (strYunSuanFu[1] == "×")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] - intYunSuanShu[1] * intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] - intYunSuanShu[1] * intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
 
                if (strYunSuanFu[1] == "÷")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] - intYunSuanShu[1] / intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] - intYunSuanShu[1] / intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
            }
 
 
 
            if (strYunSuanFu[0] == "×")
            {
                if (strYunSuanFu[1] == "+")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] + intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] + intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
                if (strYunSuanFu[1] == "-")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] - intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] - intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
                if (strYunSuanFu[1] == "×")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] * intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "-")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] * intYunSuanShu[2] - intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "×")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] * intYunSuanShu[2] * intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "÷")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] * intYunSuanShu[2] / intYunSuanShu[3];
                    }
                }
                if (strYunSuanFu[1] == "÷")   //strYunSuanFu[1]=="÷"
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] / intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "-")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] / intYunSuanShu[2] - intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "×")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] / intYunSuanShu[2] * intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "÷")
                    {
                        jieguo = intYunSuanShu[0] * intYunSuanShu[1] / intYunSuanShu[2] / intYunSuanShu[3];
                    }
                }
            }
            if (strYunSuanFu[0] == "÷")
            {
                if (strYunSuanFu[1] == "+")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] / intYunSuanShu[1] + intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] / intYunSuanShu[1] + intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
                if (strYunSuanFu[1] == "-")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] / intYunSuanShu[1] - intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    else
                    {
                        jieguo = intYunSuanShu[0] / intYunSuanShu[1] - intYunSuanShu[2] - intYunSuanShu[3];
                    }
                }
                if (strYunSuanFu[1] == "×")
                {
                    if (strYunSuanFu[2] == "+")
                    {
                        jieguo = intYunSuanShu[0] / intYunSuanShu[1] * intYunSuanShu[2] + intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "-")
                    {
                        jieguo = intYunSuanShu[0] / intYunSuanShu[1] * intYunSuanShu[2] - intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "×")
                    {
                        jieguo = intYunSuanShu[0] / intYunSuanShu[1] * intYunSuanShu[2] * intYunSuanShu[3];
                    }
                    if (strYunSuanFu[2] == "÷")
                    {
                        jieguo = intYunSuanShu[0] / intYunSuanShu[1] * intYunSuanShu[2] / intYunSuanShu[3];
                    }
                }
 
            }
        }
 
 
        return jieguo;
    }
 
    //乘除运算的输出
    public void MDOutput(int intNumC[], String stringOperator[], int intYunSFLen[],int intPrintS)
    {
        //对运算式进行输出
            int fuhaojishus0 = 0;
            for (int shuchushuzi = 0; shuchushuzi < 4; shuchushuzi++)
            {
                if (shuchushuzi == 0)
                {
                    if (stringOperator[0] == "(")
                    {
                        //cout << stringOperator[0];原始的
                        outoperater[shengchenggeshu]=""+stringOperator[0];
                        fuhaojishus0 = 1;
 
                        if (stringOperator[1] == "(")
                        {
                            //cout << stringOperator[0];原始的
                            outoperater[shengchenggeshu]=""+stringOperator[0];
                            fuhaojishus0 = 2;
                        }
                    }
 
                }
 
                //cout << intNumC[shuchushuzi];原始的
                outoperater[shengchenggeshu]=""+intNumC[shuchushuzi];
 
                for (; fuhaojishus0 < intYunSFLen[0];)
                {
                    while (stringOperator[fuhaojishus0] == ")")
                    {
                        //cout << ")";
                        outoperater[shengchenggeshu]=""+")";
                        fuhaojishus0 += 1;
                    }
                    if (fuhaojishus0 < intYunSFLen[0])
                    {
                        //cout << stringOperator[fuhaojishus0];    //输出右括号紧邻的运算符或者是输出第一个符号
                        outoperater[shengchenggeshu]=""+stringOperator[fuhaojishus0];
                    }
 
                    fuhaojishus0 += 1;
                    while (stringOperator[fuhaojishus0] == "(")
                    {
                        //cout << "(";
                        outoperater[shengchenggeshu]=""+"(";
                        fuhaojishus0 += 1;
                    }
                    break;
                }
            }
         
            shengchenggeshu=shengchenggeshu+1;
    }
 
    //
 
    public void output_ChengChu(int A[], String B[], int min, int max, int kuohao, int print)
    {
        int kuohaoNum = 0;
 
        create_Operand(A, min, max);
        MulDivShuZus(B);
        int[] suanfuNum=new int[1];
        suanfuNum[0] = YSShuZus(B, kuohao);
        RemainderFouction(A, B, suanfuNum);
        if (3 == suanfuNum[0])
        {
                //cout << A[0] << " " << B[0] << " " << A[1] << " " << B[1] << " " << A[2] << " " << B[2] << " " << A[3] << " = " << endl;
                outoperater[shengchenggeshu]=""+A[0]+B[0]+A[1]+B[1]+A[2]+B[2]+A[3]+"=";
                shengchenggeshu=shengchenggeshu+1;
        }
        else
        {
            for (int i = 0; i < suanfuNum[0]; i++)
            {
                if ((B[i] == "(") || (B[i] == ")"))
                {
                    if (i == 0 || ((i != 0) && B[i] == "("))
                    {
                        kuohaoNum++;
                        //cout << B[i];
                        outoperater[shengchenggeshu]=""+B[i];
                        continue;
                    }
                    else
                    {
                        //cout << A[i - kuohaoNum];
                        outoperater[shengchenggeshu]=""+A[i - kuohaoNum];
                        kuohaoNum++;
                        //cout << B[i];
                        outoperater[shengchenggeshu]=""+B[i];
                        continue;
                    }
                }
                else
                {
                    if (B[i - 1] == "(")
                    {
                        //cout << A[i - kuohaoNum] << B[i];
                        outoperater[shengchenggeshu]=""+A[i - kuohaoNum] + B[i];
                    }
                    else
                    {
                        //cout << B[i] << A[i - kuohaoNum + 1];
                        outoperater[shengchenggeshu]=""+B[i] + A[i - kuohaoNum + 1];
                    }
                }
            }
            //cout << " = " << endl;
            outoperater[shengchenggeshu]=""+"=";
            shengchenggeshu=shengchenggeshu+1;
        }
    }
 
    //主函数
    public int Operater()
    {
        int intPrintStyle=0;
        int intYunSFLen[] = new int[1];            //记录运算符长度
        intYunSFLen[0]=0;
         
        double dobResult;    //记录结果值
        int intNumA[]=new int[100];
        int intNumB[]=new int[100];      //两个数组,存储运算数
        createArray(intNumA, intNumB, count, min, max);   //生成两个数组
 
        String stringOperator[]=new String[10];
        for (int i = 0; i < 10; i++)
        {
            stringOperator[i] = "a";
        }
        int intNumC[]=new int[4];     //运算数的数组,存储4个数
 
        for (int outI = 0; outI < count; outI++)
        {
            if (intNumA[outI] < intNumB[outI])   //生成多位整数进行运算
            {
                for (int i = 0; i < 4; i++)    //生成数组,存储4个整数
                {
                    intNumC[i] = min + random.nextInt(max - min + 1);
                }
 
                YSShuZu(stringOperator, multiplydivide, parentheses, intYunSFLen);   //生成运算符
 
                if (1==multiplydivide)
                {
                    if (0 == remainder)
                    {
                        RemainderFouction(intNumC, stringOperator, intYunSFLen);      //不能出现余数
                        int intInR;
                        MDOutput(intNumC, stringOperator, intYunSFLen,intPrintStyle);
                        dobResult = OperatorMD(intNumC, stringOperator, intYunSFLen);
                        outresult[shengchengshushu]=dobResult;
                        shengchengshushu=shengchengshushu+1;
                    }
 
                    if (1 == remainder)
                    {
 
                        MDOutput(intNumC, stringOperator, intYunSFLen,intPrintStyle);
                        dobResult = OperatorMD(intNumC, stringOperator, intYunSFLen);
                        dobResult = OperatorMD(intNumC, stringOperator, intYunSFLen);
                        outresult[shengchengshushu]=dobResult;
                        shengchengshushu=shengchengshushu+1;
                    }
                     
                }
                if (0==multiplydivide)
                {
                    minus_JiaJian(intNumA,stringOperator,min,max,minus,parentheses,intPrintStyle);
                }          
            }
            else    //使用数组intNumA[100],intNumB[100]中的数进行真分数进行运算
            {
                calculate_ProperFraction(intNumA, intNumB, outI, min, max, intPrintStyle);
            }
        }
 
        return 0;
    }
     
 
}

  

运行结果截图:

posted @   鹄立丹香  阅读(525)  评论(1编辑  收藏  举报
编辑推荐:
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
· 现代计算机视觉入门之:什么是图片特征编码
阅读排行:
· 手把手教你在本地部署DeepSeek R1,搭建web-ui ,建议收藏!
· Spring AI + Ollama 实现 deepseek-r1 的API服务和调用
· 数据库服务器 SQL Server 版本升级公告
· 程序员常用高效实用工具推荐,办公效率提升利器!
· C#/.NET/.NET Core技术前沿周刊 | 第 23 期(2025年1.20-1.26)
点击右上角即可分享
微信分享提示