GitHub Project Address: Https://github.com/sumilekaedei/Myapp.git
Title: Implement a command-line program that automatically generates arithmetic topics for primary schools.
Natural number: 0, 1, 2, ....
- True score: 1/2, 1/3, 2/3, 1/4, 1 ' 1/2, ....
- Operator: +,?, X,÷.
- Parentheses: (,).
- equals sign: =.
- Separators: spaces (for arithmetic characters and before and after).
- An arithmetic expression:
E = n | E1 + E2 | E1? E2 | E1xe2 | E1÷e2 | (e),
where E, E1 and E2 are expressions, n is the natural number or the true fraction.
- Arithmetic title: E =, where e is an arithmetic expression.
Effectiveness Analysis: The formulas for 1, 2, and 3 operators are discussed, the possible cases are listed, and the situation which is not mentioned in it is improved.
Design implementation process: one of the main functions and five sub-functions, sub-functions will also call each other. In the main function, the function that generates the problem is called, and then the problem function calls the random function and generates the answer function, and the function that generates the answer also calls the function that generates the question function and the division of the divide.
Code Description:
#include <stdio.h>#include<time.h>#include<stdlib.h>#include<string.h>CharGetsignal ()//operatorintRandomintA//Random numberintgcdintXintY//Euclidean MethodintAnswersintYintNumintNUM1,intNUM2,intNUM3,intNUM4,CharSignal1,CharSignal2,CharSignal3,intR//Generate AnswersintQuestionintYintR//Generate Topics{FILE*FP;//Srand ((unsigned) time (0)); int Get; intnum,num1,num2,num3,num4; CharSignal1,signal2,signal3; Signal1=getsignal (); Signal2=getsignal (); Signal3=getsignal (); NUM1=random (R); Num2=random (R); NUM3=random (R); NUM4=random (R); Num=rand ()%3+1; if(num==1) {answers (y,num,num1,num2,num3,num4,signal1,signal2,signal3,r); FP=fopen ("Exercises.txt","a"); fprintf (FP,"topic%d:%d%c%d = \ n", y,num1,signal1,num2); Fclose (FP); } if(num==2) {answers (y,num,num1,num2,num3,num4,signal1,signal2,signal3,r); FP=fopen ("Exercises.txt","a"); fprintf (FP,"topic%d:%d%c%d%c%d = \ n", Y,NUM1,SIGNAL1,NUM2,SIGNAL2,NUM3); Fclose (FP); } if(num==3) {answers (y,num,num1,num2,num3,num4,signal1,signal2,signal3,r); FP=fopen ("Exercises.txt","a"); fprintf (FP,"topic%d:%d%c%d%c%d%c%d = \ n", Y,NUM1,SIGNAL1,NUM2,SIGNAL2,NUM3,SIGNAL3,NUM4); Fclose (FP); } return 0;} intMain () {srand (unsigned) time (0)); FILE*FP; FP=fopen ("Exercises.txt","W"); Fclose (FP); FP=fopen ("Answers.txt","W"); Fclose (FP);intN,r;inty=1;Charargv1[3];Charargv2[3]; //n=10,r=10;scanf"%s", ARGV1);//- Nscanf"%d",&N); scanf ("%s", ARGV2);//- Rscanf"%d",&R);if(!STRCMP (ARGV1,"- N") &&!strcmp (Argv2,"- R")) { while(n>0) {question (y,r); Y++; N--; } }Elseprintf"input Error! ");return 0;}
Test run:
PSP2.1 form:
PSP2.1 |
Personal Software Process Stages |
Estimated time-consuming (minutes) |
Actual time elapsed (minutes) |
Planning |
Plan |
|
|
· Estimate |
· Estimate how long this task will take |
720 |
2160 |
Development |
Development |
|
|
· Analysis |
· Demand analysis (including learning new technologies) |
240 |
720 |
· Design Spec |
· Creating a design Document |
60 |
80 |
· Design Review |
· Design Review (and colleagues review design documents) |
120 |
150 |
· Coding Standard |
· Code specification (to develop appropriate specifications for current development) |
90 |
90 |
· Design |
· Specific design |
120 |
150 |
· Coding |
· Specific code |
600 |
1440 |
· Code Review |
· Code review |
120 |
300 |
· Test |
· Test (self-test, modify code, commit changes) |
240 |
240 |
Reporting |
Report |
|
|
· Test Report |
· Test report |
30 |
30 |
· Size Measurement |
· Computational effort |
15 |
20 |
· Postmortem & Process Improvement Plan |
· Summarize afterwards and propose process improvement plan |
30 |
30 |
Total |
|
1665 |
3330 |
Project Summary: This project, began to see the topic thought is very simple, but to the actual time, because the demand is more, do it very difficult, and many of them have not learned the practice. And this program does not do very well, although barely able to achieve basic functions, but the parentheses, the title of the true score and other functions can not be achieved, and there are many bugs have not been effectively resolved.
Implement a command-line program that automatically generates arithmetic topics for primary schools