Freshman C language first experiment: pupils teaching system, freshman pupils

Source: Internet
Author: User

Freshman C language first experiment: pupils teaching system, freshman pupils

Advanced Language Programming report

 

Deadline for submission of printed reports: January 1, November 15, 2014

Electronic report sent to 2629610662 @Qq.com, Enter the report number in the mail title

Serial number

34

Name

Xu Kai

Photo

 

Score

 

E-MAIL and telephone

18810556775

Practice questions

First job: Function

 

 

Task 6

I,Code and comments

// Edited by Xu Kai

// Edit the subject: Primary School Student Teaching System

// Date: January 1, December 2

 

# Include <stdlib. h>

# Include <stdio. h>

# Include <time. h>

Int Add (int );

Int jianfa (int );

Int chengfa (int );

Int chufa (int );

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 ++) // ten questions

{

Srand (time (NULL ));

B = rand () % 4 + 1; // random addition, subtraction, multiplication, division

Switch (B)

{

Case 1: f = Add ();

Break;

Case 2: f = jianfa ();

Break;

Case 3: f = chengfa ();

Break;

Case 4: f = chufa ();

Break;

}

If (f = 1) g = g + 10; // calculate the total score and accuracy rate

}

Printf ("% d % \ n", g, g );

} While (g <= 75 );

Return 0;

}

Int Add (int a) // Add a 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", & );

If (a = d) // determines whether a positive or false is returned and returns a value.

{

Pingjia (d );

Return 1;

}

Else

{

Pingjia1 (d );

Return 0 ;}

}

Int jianfa (int a) // subtraction Block

{

Int B, c, d;

Do // prevents negative number 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", & );

If (a = d) // determines whether a positive or false is returned and returns a value.

{Pingjia (d );

Return (1 );}

Else

{

Pingjia1 (d );

Return 0 ;}

}

Int chengfa (int)

{

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", & );

If (a = d) // determines whether a positive or false is returned and returns a value.

{Pingjia (d );

Return 1;

}

Else

{

Pingjia1 (d );

Return 0 ;}

}

Int chufa (int)

{

Int B, c, d, e;

Do // All-in-One Extraction

{

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", & );

If (a = d) // determines whether a positive or false is returned and returns a value.

{Pingjia (d );

Return 1;

}

Else

{

Pingjia1 (d );

Return 0 ;}

}

Double pingjia (int d) // comments 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) // incorrect Rating 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;

}

}

II,Running result texture

 

 

III,Problems encountered during design and debugging and Solutions

The switch statement and random number are not used, but the book reading is rare. It has been solved after reading the book. In addition, the for statement has not been assigned an initial value. It has been corrected by teacher Bobo. At first, the continuous use of if in the main function made the program not beautiful. After reading the book, I switched to switch. The function naming is really disgusting. Due to my limited level of English, it has not been solved yet.

IV,Experience and self-evaluation of the program

Do not delay, it looks very difficult, when you get out of the first step, you can use copy and paste to run, the program is basically complete and beautiful, the biggest defect is that the delivery time is too late, in fact, it is about the system, that's the case. In the future, there will be hundreds of lines of programs that will be compiled with care. However, I don't know much about some c statements and skills, and I need to work harder. In general, it is okay and has reached the internal standards. Come on !!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.