Requirements:
1 topics to avoid duplication
2 Customizable (Qty/print mode)
3 can control the following parameters: whether there is a multiplication method, whether there are parentheses, the range of values, plus or minus a negative number, division has a zero, whether to support fractions (true score false score), whether to support decimals (accurate to how many bits), the interval of each line in the printing.
Solution Ideas:
1. Avoid duplication: Random number function + system time generates every random number, each one is stored, each generation of the equation is checked once, if the repetition is re-generated. Use a function when checking the equation.
2. Customizable: Use for loop to control the quantity, the specific quantity has the user input, each line outputs several formulas by the user input, and stores.
3. Control parameters: At the beginning of the program design interface used by the user input requirements, will be required to store. The set of parameters is stored uniformly together.
(1) Whether there is a multiplication method: randomly generated operation symbols, subtraction storage, cs[0] Storage
(2) Whether there are parentheses: stored with a[1], 1 with parentheses, and 0 o'clock without parentheses.
(3) Numerical range: with a[2] storage, with A+rand ()%b, to achieve.
(4) The addition and subtraction of negative numbers: with A[3] storage, using the IF statement to determine the storage requirements.
(5) Division has an empty number: with A[4] storage, for 1 o'clock hours, the number of 0 o'clock. Use the function to check whether each of the equations is a surplus.
(6) Whether to support decimals (accurate to how many bits): stored with a[5], 0 o'clock no decimal, n time, is n decimal place.
(7) The interval of each line in the printing: storage with a[6], 0 o'clock no interval, n, Interval n rows.
Arithmetic (2) design ideas