Learn from the article:
I. Demand analysis
1. User Portrait
User group: Elementary school students
User characteristics: Small age, in the primary learning stage of mathematics
User needs: Get arithmetic title, answer questions, view statistical results
2. Functional Requirements
1. Use the-n parameter to control the number of generated topics, using the-R parameter to control the range of values (natural number, true fraction, and true fraction denominator) in the topic
2. The number of operators in each topic does not exceed 3
3. If a false score is applied to the title and the result of the calculation, the true fractional representation
4. Put the generated topic into Exercise.txt, the answer of the question is deposited in Answer.txt, the user does the result to deposit Grade.txt
5. The program supports the generation of 10,000 topics
6. Check the generated topics
Two. Functional design
Basic functions: Generate expressions, weigh-in expressions, generate answers, submit responses, statistical results
Expansion function: input parameter legality detection and error prompt, ButtonClick quick Open TXT file
Advanced Features: Software graphics Interactive Interface
Three. Design and implementation
(part of the code)
1. Generate an expression binary tree:
Constructs the binary tree, puts the operand into the leaf node, the operator puts the non-leaf node, and recursively generates the expression Tree.getroot (). s
2. Generate the standard answer: post-traverse binary tree generation arithmetic expression, and calculate the answer Tree.getroot (). Value
3. Expression Check Weight: Tree structure adjustment to left dial hand tree is always larger than the right sub-tree, then compare the height of the tree, the number of operators, the structure of the tree
4. Deposit expressions, answers, and statistical results into Exercises.txt, Answers.txt, Grade.txt, respectively
5. False fractions converted to true fractions:
Four. Test results
Five. Source code
Project Address: Https://gitee.com/Linzhiyuan666/math.git
Six. Summary
This experiment deepened my understanding and mastering of data structure, compiling principle knowledge, object-oriented thought, and encountered many problems in the course of experiment, especially how to realize accurate and high efficiency to check the weight of 10000 questions, and finally solved the problem by adjusting the tree structure and optimizing the algorithm of checking the weight. Because of the understanding of C #, the use of the. Net framwork framework by the way to achieve a software graphics interface, making it more convenient and experience better, in the design of graphical interface process to do a lot of experience to optimize, such as parameter legality detection and error hints, ButtonClick Quick Open txt file, expression and answer content preview of the ListView, interface layout, etc., which deepened my understanding of product design and grasp.
Personal work Arithmetic topic generation Program (Windows desktop application)