| The Link Your Class | https://bbs.csdn.net/forums/MUEE308FZ |
|---|---|
| The Link of Requirement of This Assignment | https://bbs.csdn.net/topics/600798588 |
| The Aim of This Assignment | Extract keywords of different levels from the C or C++ code files that are read in. |
| MU STU ID and FZU STU ID | 19103212 & 831902210 |
PSP form
| Personal Software Process Stages | Estimated Time(minutes) | Completed Time(minutes) |
|---|---|---|
| Planning | - | - |
| Estimate | 20 | 20 |
| Development | - | - |
| Analysis | 60 | 90 |
| Design Spec | 60 | 90 |
| Design Review | 30 | 30 |
| Coding Standard | 30 | 30 |
| Design | 30 | 30 |
| Coding | 1500 | 1500 |
| Code Review Planning | 120 | 90 |
| Test | 60 | 30 |
| Reporting | - | - |
| Test Report | 60 | 60 |
| Size Measurement | 30 | 30 |
| Postmortem&Process Improvement | 60 | 60 |
| Total | 2060 | 2060 |
2.Program Requirements
- Basic requirement: output "keyword" statistics
- Advanced requirement: output the number of "switch case" structures, and output the number of "case" corresponding to each group
- Uplifting requirement: output the number of "if else" structures
- Ultimate requirement: output the number of "if, else if, else" structures
Before completing the more difficult requirements, you need to complete the Lower requirements.
In order to meet the needs of the above process, I choose c++ as the programming language for searching and solving because of the compatibility and high efficiency of c++, which I am most familiar with.
According to the periodic testing requirements, we need to calculate the frequency and scheme structure of specific words, and I think the whole process is to clear the overall goal of the file, then calculate the qualified phrase, and finally get the overall result. So I'm reviewing C + + about S streams and files; Search gitub, CNblogs, CSDN. Then I saw a blog about using substrings and getting a job, which was my main step in processing information.
A search function that provides the schema with a specific part of the series and moves that metric to the first character of a qualifying word. There are two mature and packaged functions

3. Design and implementation process
The program is obtained with command line arguments. Stream the file from the CPP file and send it to the corresponding string variable. This is convenient for functions to read and call files. When function statistics are called, the file stream is directly compared to the string array keyword, the number of words is logged into account, and the total number of words is logged into the number int variable.
Basic Requirements:

Advanced requirement:
Uplifting requirement & Ultimate requirement:

4.Test samples and results
test example:
#include <stdio.h>
int main(){
int i = 1;
double j = 0;
long f;
switch(i){
case 0:
break;
case 1:
break;
case 2:
break;
default:
break;
}
switch(i){
case 0:
break;
case 1:
break;
default:
break;
}
if(i<0){
if(i<-1){}
else{}
}
else if(i>0){
if(i>2){}
else if(i==2){}
else if(i>1){}
else{}
}
else{
if(j!=0){}
else{}
}
return 0;
}
input data example:
Please enter the path of the file in an absolute path:
D:\CS_java\src\software\test.c
Please enter the select_mod
4
result:
total num: 35
switch num: 2
case num: 3 2
if-else num: 2
if -else if- else num: 2
5.Summary
The whole experiment was very challenging and I learned a lot from it. Although the program can only basically meet the requirements of the laboratory, there are still many deficiencies. Therefore, there is some room for improvement and development. I hope I can make progress in 3 months
My GitHub repository link:https://github.com/cottons12/cottons12
