EE308-Lab5

SNNBBY 2021-10-18 21:33:29
The Link Your Class https://bbs.csdn.net/forums/MUEE308FZ?category=0
The Link of Requirement of This Assignment https://bbs.csdn.net/topics/601188617
MU STU ID and FZU STU ID19105592 & 831902115
Teammate1's MU STU ID and FZU STU ID19105932 & 831902104
Teammate2's MU STU ID and FZU STU ID19105576 & 831902202
Teammate3's MU STU ID and FZU STU ID19104031 & 831902114
Teammate4's MU STU ID and FZU STU ID19103158 & 831902116
GitHub link https://github.com/1252845841hhAs/Lab05-Snowed-in-Taipei-

PSP Form

PSPPersonal Software Process StageEstimated Time (minutes)Actual Time (minutes)
PlanningMake a plan1010
EstimateEstimate how long the task will take160175
DevelopmentThe development of78
AnalysisRequirements analysis (including learning new technology)1214
Design SpecGenerate design documents66
Design ReviewDesign review34
Coding StandardCode specifications (develop appropriate specifications for current development)33
DesignSpecific design4042
CodingSpecific coding120130
Code ReviewCode review78
TestTest (self-test, modify code, commit changes)1020
ReportingReport1010
TestTest report--
Postmortem&Process ImprovementSummarize afterwards and propose process improvement plan67
Summary-160175

Learning Progress Bar

hoursnew code(line)Cumulative code (line)Important growth
0.500Analyze the experimental project, establish the general framework, the team leader to the division of labor
1150150Use if, switch, and for statements
0.52020How to generate random numbers
0.51010How to keep two decimal places
100Program result testing and modification & Blog Writing

The Division Of Responsibilities Of Team Members

Team MembersMU IDThe Division Of Responsibilities
Yue Zhuo19105592Grade 1 to grade 2: addition and subtraction of integers within 100 and github
Jinhan Lin19103158Grade 1 to grade 2: addition and subtraction of integers within 100 and github
Chuan He19104031Grades 3 to 4: addition, subtraction, multiplication and division of integers and CSDN
Yanqi Fan19105932Grades 3 to 4: addition, subtraction, multiplication and division of integers and CSDN
Yaxing Li19105576Grades 5 to 6: addition, subtraction, multiplication and division including decimals

Program Running Environment

C++


Screenshot of the Software Running

img

img

img


Event

Firstly, in the design process, we found that multiple layers of identification input and different operations are required this time, which is different from the single or single-layer input and judgment we faced before.

Secondly, since the use of random numbers is involved, we are not familiar with the call of such functions. Therefore, we have fully understood the use of Rand functions through consulting materials. At the same time, we note that random numbers can also help us generate random operators. Since Grades 3-6 need to calculate multiplication and division, we use if statements to represent "+" "-" "*" "/" by generating four numbers: 0, 1, 2 and 3. After running the program, we found that there are some small mathematical problems in the program. For example, negative numbers and divisor 0 may occur during subtraction. We also realized through the code that there will be no questions with negative answers and divisor 0.

#include <time.h>
srand(time(NULL));
int a=rand()%100;
int b=rand()%100;

Thirdly, when generating decimals, sometimes the answer is infinite decimals, and the result we need is to retain two decimal places. After the brainstorming of team members, we use the following methods to realize the operation of retaining two decimal places. We first add 0.005 to the obtained data, and this step realizes the rounding of the two decimal places after the decimal point, Then multiply the number by 100 to get an integer of type int, and then divide by 100 to get a floating-point number in the form of float, that is, the answer we need.

double a=(double)(rand())/1000;
double b=(double)(rand())/1000;
a = ((float)((int)((a+0.005)*100))/100);
b = ((float)((int)((b+0.005)*100))/100);

Finally, in order to accomplish the main function, we use the random numbers and get the results. Then, we compare the result to the answer that typed in. We divided the whole score, which is 100, by the number of questions. If the answer is true, we add the score. If wrong, we lose the score. At the end, we calculate the scores we gain, and show it on the screen.

for(size; size>0; size--) {
        int type=rand()%2;
        if(type==0) {
            int a=rand()%100;
            int b=rand()%100;
            int result;
            result=a+b;
            cout<<a;
            cout<<"+";
            cout<<b;
            cout<<"=";
            int student;
            cin>>student;
            if(student==result) {
                source=source+source1;
                i++;
            }
        }

Team Programming Experience

img


Summary

  We used C + + to complete today's laboratory. Through this laboratory, we skillfully mastered the generation and use of random numbers. By realizing some relevant mathematical functions, we improved our ability to convert our ideas into actual code to realize the functions we need.

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

183

社区成员

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

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