EE308 LAB1_2

taohhoat 2022-10-28 06:02:36

EE308 LAB1_2 2022

Catalogue

  • EE308 LAB1_2 2022
  • PSP form
  • Basic Idea
  • Design & Implement
  • Code Explanation
  • Result
  • Summary

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 ID20124066 & 832002123

MY GITHUB:https://github.com/taohhoat/EE308_LAB12

PSP form

Personal Software Process StagesEstimated Time/minutesCompleted Time/minutes
Planning2530
Estimate2530
Development5040
Analysis3030
Design Spec3020
Design Review1010
Coding Standard1510
Design1010
Coding7085
Code Review Planning2020
Test1030
Reporting6570
Test Report1530
Size Measurement1520
Postmortem & Process Improvement4040
total430475

Basic Idea

I use c++ to solve the problem.
I know the most different part in the project is that we need frequently use String and char [] to solve the problem.
First, i review the information about Import a directory usage and how to deal with the content in a ".txt" line by line.
Second, i clearly draw a picture which shows the connection between 4 steps.
I use draw.io to picture a link map.

在这里插入图片描述

Design & Implement

在这里插入图片描述


step 1 and 2:
It is easy to think that we can just use a String array to carry all the keywords, and order to find the words same as the word in the array;
The same way to find the "switch ".

step 3 and 4:
It is hard to discuss because "if else " and "if else if " have same part. So we can use a double loops. First loop is to judge whether " if else if " is finding. If is found, no more operation. Else judge the another "else ".

Code Explanation

在这里插入图片描述


This is where I started using the stack structure. A stack is a data structure in which items are arranged in order, and items can only be inserted and deleted at one end (called the top of the stack). When I find cases, I will sum them up and calculate the number of cases. When I traverse to default, I will end the sum up. Or when I encounter the next switch, I will add the switch and re-stack the number

在这里插入图片描述

when the second one finds the else and then finds the if, if follows, it will print the Boolean to false. I check to see if there is an if or else if form stored at the top of the stack, and count if there is, otherwise it doesn't work

Result

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

Performance optimization:
stack using is not a better way than loop, it cause more time because of it's mechanism .Then i may use two loop to replace the process of dealing with the step3 and 4.

Summary

It is the first time i use Git. I know the advantages of Git well which allow me to change and optimize my code better in the next time. And i use github to save my code, it is better to see the change in my process.

...全文
282 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

285

社区成员

发帖
与我相关
我的任务
社区描述
福州大学 梅努斯国际工程学院 软件工程(2022秋) 教学
软件工程 高校
社区管理员
  • LinQF39
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧