285
社区成员
发帖
与我相关
我的任务
分享
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 | To achieve a program function, it can extract keywords of different levels from the C or C++ code files that are read in. |
MU STU ID and FZU STU ID | 20123116_832001212 |
Personal Software Process Stages | Estimated time/minutes | Completed Time/minutes |
---|---|---|
Planning | 30 | 40 |
Estimate | 15 | 30 |
Development | 30 | 30 |
Analysis | 90 | 120 |
Design Spec | 10 | 20 |
Design Review | 20 | 20 |
Coding Standard | 30 | 35 |
Design | 50 | 90 |
Coding | 120 | 180 |
Code Review | 10 | 15 |
Test | 20 | 20 |
Postmortem & Process Improvement Plan | 30 | 60 |
Total | 455 | 660 |
#include <iostream>
using namespace std;
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;
}
string Keyword[32]=
{
"auto", "break", "case", "char", "const", "continue", "default", "double",
"do", "else", "enum", "extern", "float", "for", "goto", "if", "int", "long",
"register", "return", "short", "signed", "sizeof", "static", "struct",
"switch", "typedef", "union", "unsigned", "void", "volatile", "while"
};
for (int i = 0; i < 32; i++ ) {
if (match(str, Keyword[i]) == 1) {
total_num++;
break;
}
}
for (int i = 0; i < 32; i++ ) {
if (match(str, Keyword[i]) == 1){
if (match(str, "switch") ) {
Case_num.push_back(case_num);
switch_num++;
case_num = 0;
}
if (match(str, "case")){
case_num++;
}
break;
}
}
if (match(str, "else if" )){
top++;
stack[top] = 2;
}
else {
if (match(str, "else")) {
if (stack[top] == 1 ) {
if_else_num++;
top--;
}
else {
if (stack[top] == 2 ) {
if_elseif_else_num++;
top--;
}
}
}
else {
if (match(str, "if")) {
top++;
stack[top] = 1;
}
}
}
I think this task is difficult. The time I finish the report is beyond the estimated time but I have learnt a lot, such as C++ programing and github.