Software Engineering course Assignment (iii)--Arithmetic 3 (c + +)

Source: Internet
Author: User

Partner Links: http://www.cnblogs.com/haoying1994/

First, design ideas

In the previous program has the function: plus minus there are no negative numbers, Division has no number, the printing method has screen output and file output and the function of the formula can be customized, the program added the calculation results, prompting the user results correct or not, correct and wrong number of functions.
1. For the selection of operators and the number of calculations, the length of each formula is generated by the random number function.
2. For calculation of calculations:
When there are only two numbers of subtraction without parentheses, consider whether a negative number is present at the time of reduction, and consider whether the remainder is present except.
Multiple number of add and subtract without multiplication and parentheses: When a minus sign considers whether the preceding result is less than the meiosis, the change operator is the plus sign to ensure that the final result has no negative number.
When the number of subtraction without parentheses: in the retrieval of the multiplication number in the equation, judge the symbol after it, if there is a continuous multiplication number, especially when there is division sign, consider whether the remainder, if the surplus number is to use the method of finding dividend factor to make the time of the addition of the integer, If the null number is saved by the divisor and divisor respectively as numerator and denominator. Then the continuous sub-formula containing only the multiplication number is first calculated into another array, and then the number connected with the minus sign to the corresponding operation, when the addition and subtraction operator encountered, if the remainder, the result of using-pass method to save the results as fractions of the form. Then determine if there is a negative number, if no negative, then in the case of a minus sign, the formula in the meiosis will use random numbers to reorganize the values until the meiosis is greater than the meiosis.

3. For the calculation output aspect: The file output uses the Ofstream file output stream, the output to the problems.txt.
4. For the user to enter the answer, to determine whether the user input string matches the correct results, if the match, then the prompt congratulations to you, correct, otherwise prompted to answer the wrong, and give the correct answer. Use the cycle count to determine the correct number of answers to the question, which is displayed on the screen after the answer is completed.

Second, the source program code

Iii. Results of operation

Quantity:5 Printing method: Output to screen multiplication: no brackets: No negative: Range:0-10

Quantity:6 printing method: Output to screen multiplication: no brackets: No negative: No range:0-20

Quantity:7 printing method: Output to screen multiplication method: bracket: No negative: No range:0-20

Remainder: there

Quantity:5 Printing method: Output to screen multiplication method: bracket: No negative: Range:0-10

Remainder: None

Iv. Programming Summary and Analysis

Through the third arithmetic experiment, I learned a lot of ideas and knowledge, exercise my logical thinking, so that I improved the programming ability, benefited.

In two experiments, the four operation program has been able to achieve a number of functions, there are no negative, there are no numbers, can be customized and other functions, can make the calculation appear on the screen, but there is no output of the results. In this experiment, the calculation results are realized. In the process of compiling and debugging, many problems have been found, several times the result is incorrect or the loop is not jump, then the result is the representation of the score, the result is wrong or there is no simplification. In the general thinking of the details of the detailed consideration, in this process to make our thinking more careful, the debugging of the bug can find a faster solution.

I think let me learn more is the theme of this companion, two people together to develop each other to learn from each other the advantages of programming, can cultivate each other's cooperation awareness, the future in the work of the team to help a lot, in the discussion process, learn from experience, learning skills, can make programming efficiency greatly improved. So this experiment is very meaningful to me, in the future development of the program will play a lot of reference and help the effect, this time together and happy and successful!

V. Project plan Log

Vi. Log of time logs

Vii. Defect Record Log

Software Engineering course Assignment (iii)--Arithmetic 3 (c + +)

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.