20194739 automatically generates four arithmetic problem first edition report

First, the needs analysis

  Java or C language used to automatically generate a complete four questions calculation program, various parameters can be customized according to user's desire, and can not be duplication formula, to save the generated title result.txt in an external file.

 

Second, the functional design

  •  basic skills

  (1) automatically generates four arithmetic operation of Equation 2 number less than 10 100 (+ - * /), operation results are required within 100

   (2) discarding duplicates equation. = 2 + 3 + 3 = 2 and Equation 2 is repeated and 3 + = 3 + 2 = not repeated formula

   Number (3) title can be customized

   (4) parameters can be controlled

             Whether to include multiplication and division

             Controllable range values ​​of the operands (e.g., operands within 100 or within 1000)

             Whether operands containing negative    

     (5) generating operation to an external file title stored in result.txt

  •  extensions

    After printing the subject you can choose whether to print the answer.

 

Third, the design and implementation

   Use c language, all functions are implemented in the main function.

 

Fourth, the test run

V. snippet

  • Production can choose whether to answer

 

1      printf("是否需要答案,需要1,不需要0\n");
2          scanf("%d",&i);
3          if(i==1)  //判断是否需要答案 
4            {    fprintf(fp,"\n\n答案:\n"); 
5                 for(j=0;j<m;j++) //m为题目数量 
6               //在打印题目的同时,将运算结果存入到ans数组中 
7                     fprintf(fp,"第%d题:%.2f\n",j+1,ans[j]); 
8             }

 

  • 判断算式有无重复

 

 1            num1= rand()%n+1-e;
 2            num2= rand()%n+1-e;
 3            que[i][0]= num1;
 4            que[i][1]= num2;
 5                  //在产生随机数的同时将随机数存入que数组 
 6            for(j;j<i;j++)
 7                    if(num1==que[j][0]&&num2==que[j][1])
 8                     break;  
 9            if(j!=i) 
10             //因为是while循环,所以可以直接进行下一轮而不改变循环变量的值
11               continue;

 

六、 总结

   在编写程序的过程中没能很好的实现模块化,导致所有程序都在main函数中,看上去很乱,应该每一个功能都对应一个函数。

 

七、 PSP

 

PSP2.1

任务内容

计划共完成需要的时间(min)

实际完成需要的时间(min)

Planning

计划

10

15

·       Estimate

·  估计这个任务需要多少时间,并规划大致工作步骤

5

7

Development

开发

180

350

··       Analysis

  需求分析 (包括学习新技术)

5

10

·       Design Spec

·  生成设计文档

10

12

·       Design Review

·  设计复审 (和同事审核设计文档)

4

6

·       Coding Standard

  代码规范 (为目前的开发制定合适的规范)

6

13

·       Design

  具体设计

8

10

·       Coding

  具体编码

120

264

·       Code Review

·  代码复审

10

30

·       Test

·  测试(自我测试,修改代码,提交修改)

10

24

Reporting

报告

20

44

··       Test Report

·  测试报告

10

18

·       Size Measurement

  计算工作量

0

0

·       Postmortem & Process Improvement Plan

·  事后总结 ,并提出过程改进计划

10

18

 

Guess you like

Origin www.cnblogs.com/02-yym/p/11521712.html