Current location - Training Enrollment Network - Mathematics courses - Mathematical form 1
Mathematical form 1
Answer question 3.

Write a program and interface, enter a student's Chinese, math and English course scores, and click Calculate to get the average score and total score of the student.

Step 1. Add a control in form 1 and set its properties:

Control Control Name Title Text Description

-

Label labl_ 1? China?

Label? Labl_2 mathematics?

Label? labl_3? English?

Label? labl_4? Total score

Label? Average score of labl_5

Text box? Text 1 is empty? Leave the language score for input.

Text box? Text2 is empty? Leave it to input math scores.

Text box text3? Empty? Leave it to input English scores.

Text box text4? Empty? Stay and show the total score?

Text box text5? Empty? Let it show the average score.

Command button command 1 calculation

Step two. Double-click the command button in the form, and then type or paste the following code:

Private subcommand 1_Click ()

Dim s 1%, s2%, s3%, su%, av%' is simpler, and the scores of all subjects are rounded off.

S 1 = CInt(Text 1。 Text)' language point

S2 = CInt(Text2。 Text)' math score

S3 = CInt(Text3。 Text' English.

Su = s 1+s2+s3' to calculate the total score.

Av = su/3' Calculate the average score

Text 4. Text = CStr(su)' displays the total score.

Text 5. Text = CStr(av)' displays the average score.

End joint

Step three. Running (the running situation is shown in the screenshot below:)