Arithmetic 2 design ideas

Source: Internet
Author: User

Topic requirement: Randomly produce a arithmetic

    1. The topic avoids repetition;
    2. can be customized (quantity / printing method);
    3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.