| The link Your Class | https://bbs.csdn.net/forums/MUEE308FZ?category=0 |
|---|---|
| The link of Requirement of This Assignment | https://bbs.csdn.net/topics/600798588 |
| The Aim of This Assignment | 1. To achieve a program function 2. Extract keywords of different levels from the C++ code files that are read in 3. learn the use of github |
| MU STU ID and FZU STU ID | 19103921_831902217 |
- ✔**Content**
- **The links**
- **PSP FORM**
- **Description of problem-solving ideas**
- **The Chart of the Key Functions**
- **Code Description**
- **The entire code**
- **Summarize this assignment**
https://github.com/yyx0115/EE308_LAB2/tree/main
PSP FORM| Personal Software Process stage | Estimated Time(min) | Actual Time(min) |
|---|---|---|
| Planning | – | – |
| Estimate | 30 | 30 |
| Development | – | – |
| Analysis | 100 | 120 |
| Design Spec | 60 | 100 |
| Design Review | 15 | 15 |
| Coding Standard | 30 | 30 |
| Design | 180 | 200 |
| Coding | 1200 | 1600 |
| Code Review | 60 | 60 |
| Test | 100 | 100 |
| Reporting | – | – |
| Test Report | 30 | 30 |
| Size Measurement | 15 | 15 |
| Postmortem & Process Improvement Plan | 60 | 60 |
| Sum of Time | 1880 | 2360 |
- Choose Language
- c++/c
- Python
- java
- Review the knowledge of C/C++
we need to know the keywords:
After last semester’s study, I acquired some knowledge about Java, C ++/ C. It’s a pity that I didn’t learn Python yet. After a summer vacation of “indulgence”, before starting this assignment, I need to review the “if-else” knowledge to wake up my memory
- rough thinking
-
The file is read in the specified address
-
Create a user input class
-
a search class to find the keywords
-
a class to calculate the number of keywords and the times of switches and cases
-
use pointer function probably
-
the number of if-else and if else if else
- create a file named “in.txt” include⤵:
#includeint 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; }
-
The input⤵:
#include
using namespace std; map mp; string words[32]={"auto","case","char","const","do", "double","enum","extern","float","goto", "int","long","register","short","signed","static", "struct","typedef","union","unsigned","void","volatile","while" ,"break","continue","for","if","sizeof","switch","return","default","else"}; -
open and read the file⤵:
void getNum(char *s,int grade){
queue q;
ifstream infile;
infile.open(s,ios::in);
if (!infile){
printf("file opened failure!!!");
return ;
}
- To find the switch and case numbers⤵:
string temp;
bool judgeswitch=false;
int cntcase;
while (!infile.eof()){
infile>>temp;
//cout<
- output and the main function⤵:
int total=0;
for (auto v:mp){
//output all the keywords
//cout<>url>>grade;
getNum(url,grade);
return 0;
}
- The output⤵
The entire code
#include
using namespace std;
map mp;
string words[32]={"auto","case","char","const","do",
"double","enum","extern","float","goto",
"int","long","register","short","signed","static",
"struct","typedef","union","unsigned","void","volatile","while"
,"break","continue","for","if","sizeof","switch","return","default","else"};
void getNum(char *s,int grade){
queue q;
ifstream infile;
infile.open(s,ios::in);
if (!infile){
printf("file opened failure!!!");
return ;
}
string temp;
bool judgeswitch=false;
int cntcase;
while (!infile.eof()){
infile>>temp;
//cout<>url>>grade;
getNum(url,grade);
return 0;
}
Summarize this assignment
-
I gained new knowledge on how to use GitHub,created my own GitHub page. ♪(´▽`)
-
wrote code in the process of consolidating and reviewing the previous courses. After relearning, I found many deficiencies and did not grasp many details in place. ( •̀ ω •́ )y
-
Learned how to draw a flow chart with markdown and plan in advance with PSP form, which greatly improved the efficiency
-
I feel very guilty for not completing the last two levels of questions, and my ability still needs to be improved. `(>﹏<)′
-
The knowledge points of file flow need to be further strengthened. The reason why we choose to use C + + is that the knowledge of Java is not proficient enough and needs to be further study.



