Topic requirement: Randomly produce a arithmetic
- 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 the support score (true score, false score,... ) ) five select four;
Design ideas:
1. Set the number of printed topics and how to print them. (set two variables to determine the number of prints and how to print)
2. Determine if there is a multiplication method, if there is: if condition statement
First determine the range of values;
Determine if the addition and subtraction have negative numbers, (if conditional statements in this case if the bug algorithm, then do not record this algorithm, the other cycle of the value i minus one, to maintain the resulting problem enough)
Again, the division has a null number, (if conditional statements in this case if a bug algorithm, then the algorithm is not recorded, another loop of the value I minus one, to maintain the resulting problem enough)
Then use for Loop until how many questions are terminated, print out the title
If there is no multiplication method: (if statement)
First determine the range of values;
Determine whether the addition and subtraction have negative numbers, (in this case, if a bug algorithm, then the algorithm is not recorded, another cycle of the value i minus one, to maintain the resulting problem enough)
Then use for Loop until how many questions are terminated, print out the title
To avoid repeating the algorithm, the following methods are used:
(During the printing process, in order to avoid duplication of topics.) You need to compare two random numbers with two arrays of a[],b[]. stores a value of two random numbers. Compare two numbers if same, skip this topic, and adjust The value of I
Arithmetic 2 design ideas