EE308 Lab1_2
The Link Your Class | https://bbs.csdn.net/forums/MUEE308FZU202201 |
---|---|
The Link of Requirement of This Assignment | https://bbs.csdn.net/topics/608734907 |
The Aim of This Assignment | Keywords extraction and counting |
MU STU ID and FZU STU ID | 20124716 832001109 |
1. PSP
Personal Software Process Stages | Estimated Time/minutes | Completed Time/minutes |
---|---|---|
Planning | 30 | 45 |
Estimate | 10 | 10 |
Development | 30 | 30 |
Analysis | 60 | 70 |
Design Spec | 20 | 35 |
Design Review | 30 | 35 |
Coding Standard | 20 | 15 |
Design | 60 | 80 |
Coding | 360 | 420 |
Code Review | 10 | 10 |
Test | 30 | 45 |
Test Report | 10 | 15 |
Postmortem & Process Improvement Plan | 60 | 80 |
Total | 730 | 890 |
2. Description of problem-solving ideas
When I first saw this problem, I had no idea where to start. I tried to extract useful parts from my previous c++ code according to the content of object-oriented programming learned last semester, and query the usage of some functions on the Internet and in books, and rewrite and expand them.
3. Design and implementation process
Main Design
· I roughly divide this code into three modules:
- The first one is to change all the contents in the file into strings, and divide the strings into words and store them in an array. During this period, determine whether it is a keyword, and complete the first level.
- On the basis of the first level, whether the input reaches the second level is determined. Once it is greater than or equal to the second level, the number of switches and cases will be calculated and output will be carried out.
- The third and fourth levels are related, so I put them together. In the case of the third level, we count the number of if_else and if_elseif_else structures and store them. After the answer of the third level is output, we judge whether it reaches the fourth level and decide whether to output it.
4.Code description
(1) Code
· Enter two parameters and check
· Save the keywords in an array. Extract all the contents of the file into a line string, split the words from the string, use the substr () function to extract the letters and save them to another array, compare the two arrays one by one, count the equal number and output.
· Judge whether the ith bit of array s is equal to switch, and judge the case after swicth on this basis, save the number, and output one by one at last.
· In the case of level 3 and 4, decide if else belongs to elseif, from the current position up to the if position, if elseif is in the middle, then decide if_elseif_else quantity +1, if not, then decide if_else.
(2)GitHub Link
5.Unit test screenshots and description
· level 1 :
· level 2 :
· level 3 :
· level 4 :
6.Unit test coverage optimization and performance testing, performance optimization screenshots and descriptions
7.Summarize this assignment
I think this task is very difficult for me, and I also spent a lot of time and energy on this task. In this task, I realized that my mastery of C++ was not very proficient, which led me to consult a lot of materials and make some negligence in the process of writing code. Through this task, I reviewed the knowledge I learned last semester, and also learned some new functions and new writing methods. I hope I can finish the task proficiently in the next task.