Analog calculator for arithmetic (same priority) (2nd 3rd)

Source: Internet
Author: User

Topic Requirements

Problem Description : Analog calculator for arithmetic. Assume that only + 、-、 *,/, = Five operators, and that they have equal precedence. The calculation results are displayed when you enter =.

Sample Input : 8.5+0.5*2.5=

Sample Output : 22.5

Solution Solutions

Compared with the need to consider the priority, and there are many operators of the topic, the problem is obviously much simpler, directly read the input and analysis, and then calculate.

Source code Example

results show

Summary

Although the topic is simple, consider the details, such as the first number is negative. In addition, the Model code does not check the abnormal input, so if it is written rigorous procedures, in order to ensure robustness, must be careful error checking.

Analog calculator for arithmetic (same priority) (2nd 3rd)

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.