Arithmetic 2 programming Ideas

Source: Internet
Author: User

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

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.