20194627 automatically generates four arithmetic problem first edition report

1. Demand Analysis

 

(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

  2. Functional Design

 

 

 

 

 

 

    3. Design and Implementation

 

 

 

 

 

     4. Test Run

 

 

 

 

 

  5. Paste feel more distinctive or satisfactory snippet

 

oid printf_equation(int number,int chengchu,int fanwei,int fushu)
{
FILE *fp=fopen("C:\\Users\\ASUS\\Desktop\\a\\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);

 

  6. Summary

Through this program I added his own shortcomings, my foundation is not solid, spent a lot of time in the process of writing code, but it can not achieve more functionality, run the test and sometimes an error, also found a method to modify future You will learn professional skills.

PSP reference

 

PSP2.1

SUMMARY

Plan time (min) required to complete a total of

The actual time required for completion (min)

Planning

plan

8

6

       Estimate

· Estimate how much time this task requires, and planning generally work steps

8

6

Development

Develop

82

88

     Analysis

  Needs analysis (including learning new technologies)

6

10

     Design Spec

Generate design documents

5

6

    Design Review

· Design Review (and his colleagues reviewed the design documents)

4

6

      Coding Standard

  Code specifications (development of appropriate norms for the current development)

3

3

     Design

  Specific design

10

12

       Coding

  Specific coding

36

21

      Code Review

· Code Review

7

9

      Test

· Test (self-test, modify the code, submit modifications)

13

21

Reporting

report

9

6

       Test Report

· testing report

3

2

      Size Measurement

  Computing workload

2

1

 Postmortem & Process Improvement Plan

· Hindsight, and propose process improvement plan

3

3

Guess you like

Origin www.cnblogs.com/hzcxwz/p/11528831.html