High-level language programming report
printed report Due date: year month Day
Electronic report sent to [email protected] qq.com , The title of the message stating the number of reports ordinal name
Serial number |
34 |
Name |
Xu Qiai |
Photo |
|
Results |
|
e-mail and telephone |
18810556775 |
Internship Topics |
First job: function
- Seven the prime number of experimental questions in Quest 2-6
- Seven the computer-aided teaching system of pupils in the experimental problem (six chapters of task 6 can be completed by modular programming method)
- This 2 problem is programmed separately, that is not done in the ACM system.
- Requires a comprehensive use of the content (annotations, naming rules, indentation, etc.) in this chapter.
|
- Your code, comments, and running result maps.
- Design and debugging process encountered problems and solutions.
- Experience and self-evaluation of the procedure.
Task Six
First, code and comments
Editor: Xu Qiai
Editor's title: Primary School teaching system
Date: December 2
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int Add (int a);
int Jianfa (int a);
int CHENGFA (int a);
int chufa (int a);
Double Pingjia (int d);
Double pingjia1 (int d);
int main ()
{
int e,a,b,c,d,f,g=0;
Do
{
for (e=1;e<=10;e++)//out of 10 questions
{
Srand (Time (NULL));
B=rand ()%4+1; Random Subtraction
Switch (b)
{
Case 1:f=add (a);
Break
Case 2:f=jianfa (a);
Break
Case 3:F=CHENGFA (a);
Break
Case 4:f=chufa (a);
Break
}
if (f==1) g=g+10; Calculate total score and correct rate
}
printf ("%d%d%%\n", g,g);
}while (g<=75);
return 0;
}
int Add (int a)//addition operation block
{
int b,c,d;
Srand (Time (NULL));
B=rand ()%10+1;
C=rand ()%10+1;
D=b+c;
printf ("%d+%d=?\n", b,c);
scanf ("%d", &a);
if (A==d)//judge the correctness and return the value
{
Pingjia (d);
return 1;
}
Else
{
Pingjia1 (d);
return 0;}
}
int Jianfa (int a)//subtraction operation block
{
int b,c,d;
Do//anti-negative extraction
{
Srand (Time (NULL));
B=rand ()%10+1;
C=rand ()%10+1;
}while (B<C);
D=b-c;
printf ("%d-%d=?\n", b,c);
scanf ("%d", &a);
if (A==d)//judge the correctness and return the value
{Pingjia (d);
return (1);}
Else
{
Pingjia1 (d);
return 0;}
}
int CHENGFA (int a)
{
int b,c,d,e;
Srand (Time (NULL));
B=rand ()%10+1;
C=rand ()%10+1;
D=b*c;
printf ("%d*%d=?\n", b,c);
scanf ("%d", &a);
if (A==d)//judge the correctness and return the value
{Pingjia (d);
return 1;
}
Else
{
Pingjia1 (d);
return 0;}
}
int chufa (int a)
{
int b,c,d,e;
Do//control not to be extracted
{
Srand (Time (NULL));
B=rand ()%10+1;
C=rand ()%10+1;
}while (b<c| | b%c!=0);
D=B/C;
printf ("%d/%d=?\n", b,c);
scanf ("%d", &a);
if (A==d)//judge the correctness and return the value
{Pingjia (d);
return 1;
}
Else
{
Pingjia1 (d);
return 0;}
}
Double Pingjia (int D)//Commended evaluation system
{
Srand (Time (NULL));
D=rand ()%4+1;
Switch (d)
{
Case 1:printf ("Very good!\n");
Break
Case 2:printf ("excellent!\n");
Break
Case 3:printf ("nice work!\n");
Break
Case 4:printf ("Keep up the Good work!\n");
Break
}
}
Double pingjia1 (int d)//Wrong evaluation system
{
Srand (Time (NULL));
D=rand ()%4+1;
Switch (d)
{
Case 1:printf ("No.please try again.\n");
Break
Case 2:printf ("Wrong.try once more.\n");
Break
Case 3:printf ("Don ' t give up!\n");
Break
Case 4:printf ("not correct. Keep trying.\n ");
Break
}
}
Second, run the result map
Three, the design and debugging process encountered problems and solutions
encountered in the switch statement and the random number will not be used, mainly the book to see less, after reading has been resolved. In addition, also committed the For statement did not assign the initial value of the error, was corrected by the Bobo teacher, has also been corrected. The first time in the main function of the continuous use if the program is not beautiful, after reading to switch. And the function of the naming aspect is really disgusting, because my English proficiency is limited, has not been resolved.
Iv. experience and self-evaluation of the procedure
do not delay, it seems difficult, when the first step, you can use the copy and paste to run, the program is the most complete beauty of the most unfortunate is the time to pay too late, in fact, said the system, it is so, the next hundreds of lines of the program is not a problem. However , some of C's statements and skills are not well understood, need to work harder, in general, the line has reached the inner standard. Come on!!
First experiment of C language: Primary school students ' teaching system