Arithmetic 2(minimum of four functions)
Requirements:
The topic avoids repetition;
can be customized (quantity / printing method);
The following parameters can be controlled: whether there is a multiplication method, a range of values, plus or minus negative numbers, the division has no number, whether it supports fractions (true score, false score ...). )
Programming Ideas:
1. Avoid duplication of topics: when randomly generated numbers, whenever a problem is generated, the problem exists in the array, if there are duplicates, that is, there are two topics the same, before the output of the result set an If ... else ... Sentence to determine whether the same, if the same, delete the problem;
2. Customizable: (1) Quantity: Macro defines a #define N,(2) printing method: Every three lines, set a variable counter, whenever this variable equals at 2 , the value of this variable becomes 0; each piece of paper has a total of 30 questions;
3. Is there a multiplication method: the randomly generated numbers (subtraction 1 2 3 4 respectively) have 3 and 4;
4. Range of values: set a variable so that the randomly generated number is within the range of the variable;
5. Add or subtract with or without negative numbers: Set a if...else ... Statement whether the number is greater than 0
6. Division has an empty number: see dividend and divisor to take the remainder, to see whether its value is zero;
7. Whether the score is supported: whether the randomly generated number is integer, if it is a score true score <1, false score >1;
Arithmetic 2 programming Ideas