On the idea of arithmetic further optimization

Source: Internet
Author: User

According to the last program implementation process and the final programming results, it can be found that there are many fixed values can be entered from the keyboard, so as to meet the various requirements of different users, including the number of topics, the range of values, as well as the type of numerical values, I briefly describe my view of the design requirements.

A Avoid duplication of topics

The so-called repetition, is in the program automatically generated exercises, there are two or more questions of the first digit, the second digit and the symbol are respectively equal, so you can add a loop branch program and a conditional branch program to implement filtering.

Two Customizable quantity

The number of fixed topics in the last experiment is $, so it can be entered as a user keyboard .

Three Whether there are negative numbers

If only two numbers participate in the operation, you can compare the size of the two numbers directly, if there are more than one number of participating in the operation can be calculated by whether the result is negative and then filtered.

Four Whether there is a multiplication method

Each operation symbol in the program has a specific condition, and by adding a conditional branch you can choose whether to have a multiplication operation.

Five Whether there are decimals

Similar to adding the multiplication method, adding a conditional branch is easier to reduce for an integer, but for fractional accuracy there is no way to achieve it.

On the idea of arithmetic further optimization

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.