Four arithmetic operations 2 Design Ideas

Source: Internet
Author: User

1. Obtain related requirements for the question, such as the question quantity, multiplication and division settings, value range settings, addition and subtraction with or without negative numbers, Division with or without remainder, and whether scores are supported.

2. Based on the obtained value range, use the corresponding number of cycles to obtain the question.

3. each cycle needs to implement the previously obtained question requirements. First, check whether scores are supported and whether negative numbers are used to change the value range of randomly selected numbers, obtains the number involved in the operation.

4. generate a random operator number based on whether there is multiplication or division. If there is division, when the random operator number is division, check whether there is a remainder in this operation. If the question requires a remainder, output. If no remainder is required, the question is randomly generated.

5. When the first question is generated, the file stream is output to a TXT text. When the second question is generated, read the previous text to check whether the new question is the same as all the questions previously generated. In ABC format, if A1, B1, C1, and A2, b2, c2 are not exactly the same and can be output to a text document. In turn.

6. Print the TXT text when a sufficient number of questions are generated and meet the requirements.

Four arithmetic operations 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.