20194643 four operations automatically generate the first version of the report

 1. Demand Analysis

                 Primary school teachers to students to solve a problem, (+ - * /) four operations.

2. Functional Design

                basic skills

                     Number (1) title can be customized

                     (2) whether including multiplication and division

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

                     If (4) containing negative operand 

                 extensions

       (1) with reference to the answer for teacher            

 3. Design and Implementation

 

 4. Test Run

 

5. Paste feel more satisfied or unique code snippet, use the correct code blog garden control to display .

Output functions, the main functions accept user demand, output data.

void printf_equation(int number,int chengchu,int fanwei,int fushu)
{
        FILE *fp=fopen("suanshu.txt","at");
        while(1)
        {
            int result ;
            int x1=Number(fanwei,fushu);
            char x2=Sign(chengchu); int x3=Number(fanwei,fushu); switch(x2) { case '+': result =x1+x3;break; case '-': result =x1-x3;break; case '*': result =x1*x3;break; case '/': result =x1/x3;break; } if(result<=100&&result>=-100) { fprintf(fp,"%d %c %d = %d\n",x1,x2,x3,result); number--; } if(!number)break; } char ch; if((fp=fopen("suanshu.txt","r"))==NULL) { printf(" \n 保存失败 \n"); exit(0); } else { printf(" \n 保存在suanshu.txt成功 \n"); } ch=fgetc(fp); while(ch!=EOF) { putchar(ch); ch=fgetc(fp); } fclose(fp); }

操作数函数主要功能控制操作数范围,和正负

int Number(int x,int symbol)
{
    
    if(symbol) 
    return rand()%x+1 ;
    else
    {
        int flag = rand()%2;
        if(flag) { return (rand()%x+1)*-1; } else { return (rand()%x+1); } } }

 

         

6. 总结:你设计的程序如何实现软件设计的“模块化”原则。

函数分别实现具体功能

7. 尝试撰写PSP,这个环节重要的是让自己看到自己的估计和实际消耗时间,哪个环节耗时最多,哪个环节估计和实践相差巨大?为什么?

PSP2.1

任务内容

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

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

Planning

计划

2

30

·       Estimate

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

8

5

Development

开发

400

500

··       Analysis

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

6

10

·       Design Spec

·  生成设计文档

5

10

·       Design Review

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

4

10

·       Coding Standard

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

3

0

·       Design

  具体设计

10

10

·       Coding

  具体编码

36

10

·       Code Review

·  代码复审

7

20

·       Test

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

13

10

Reporting

报告

9

30

··       Test Report

·  测试报告

3

10

·       Size Measurement

  计算工作量

2

1

·       Postmortem & Process Improvement Plan

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

3

3

Guess you like

Origin www.cnblogs.com/When6/p/11515156.html