Making a game scoring system with PowerPoint

Source: Internet
Author: User
Tags empty goto

Recently, the organization organized an English conversation contest, the author used PowerPoint embedded VBA function produced an instant scoring system, by teachers and students alike, is the production process to share with you.

Preparation: Create a new folder called "Scoring System" on the desktop to store information about teams, including the names of each team in Name.txt (in advance, each team name).

Start work: Create a new blank slide, find the Toolbar submenu under the View menu, and select the Control Toolbox (you can also change the main interface style depending on your actual needs). Adjust the position of the corresponding control, the jury photo is "image control", the following score is "text box", two buttons with "command button", put the control after the adjustment of the properties of each control to beautify the interface, can also be inserted according to the actual needs of the picture to decorate.

The main interface of the scoring system includes 8 judges ' photos and each judge's score (pictured), and the function buttons include "Empty" and "final score".

The name of the text box for each score score is txts1,txts2 ... TxtS8, the last score button has the name Commandtotal, and the second slide shows the final score with the label name Lbltotal.

Design work: Open the VBA Editor to write code:

' Specify the statistics file for each set of scores for the folder

Const path$ = "C:windowsdesktop Scoring System"

' global variable, final total score

Dim Sum as Single

' global variable, last average score

Dim Averagescore as Single

' Global variable, record group times, save automatically add 1

Dim Groupnum as Integer

' Clear the judges ' score and empty ' the final score '

Private Sub CommandButton1_Click ()

Txts1.text = ""

Txts2.text = ""

Txts3.text = ""

Txts4.text = ""

Txts5.text = ""

Txts6.text = ""

Txts7.text = ""

Txts8.text = ""

' Clear the final score for the next slide

Slide2.LblTotal.Caption = ""

End Sub

' Last Score ' button

Private Sub Commandtotal_click ()

On Error GoTo ER

Dim Sum as Single

' Add the scores of the 8 judges to total sum

sum = sum + csng (txts1.text)

sum = sum + csng (txts2.text)

sum = sum + csng (txts3.text)

sum = sum + csng (txts4.text)

sum = sum + csng (txts5.text)

sum = sum + csng (txts6.text)

sum = sum + csng (txts7.text)

sum = sum + csng (txts8.text)

' Calculate the final score (average score), accurate to 3 digits after the decimal point

Averagescore = Format (SUM/8, "#.###")

' Second slide shows final score

Slide2.LblTotal.Caption = Averagescore

' Write the final score

If groupnum>=1 and Groupnum <= 5 Then

Open path$ && "InpScore.txt" for Append as #1

Print #1, Averagescore

Close #1

End If

Groupnum = groupnum + 1

Er

End Sub

Create a new module, write the following code, here for the award module.

' Award 1 First Prize, Second Prize 2, third Prize 3, so counter variable set to 6

Const Counter = 6

Public StrName (Counter) as String

Public Sngscore (Counter) as single

' Module function: Read the score file and sort the score

Public Sub READDATAINP ()

On Error GoTo ER

Open path$ && "InpName.txt" for Input as #1

For i = 1 to Counter

Input #1, StrName (i)

Next

Close #1

Open path$ && "InpScore.txt" for Input as #2

For i = 1 to Counter

Input #2, Sngscore (i)

Next

Close #2

For i = 1 to Counter

For j = 1 to Counter

If Sngscore (i) > Sngscore (j) Then

A = Sngscore (i): Sngscore (i) = Sngscore (j): Sngscore (j) = A

b = StrName (i): StrName (i) = StrName (j): StrName (j) = b

End If

Next

Next

Er

End Sub

Create a new slide to display the third prize winners, the button name is cmddisply,6 text box name is TxtThirdPrize1 ... TxtThirdPrize6.

The code is as follows:

Private Sub Cmddisply_click ()

Readdatainp

Because the scores are sorted from high to low, the last three groups are exported first

Txtthirdprize1.text = StrName (4)

Txtthirdprize2.text = StrName (5)

Txtthirdprize3.text = StrName (6)

When making, you can also add other slides for modification, such as making a dynamic effect of the beginning of the screen and the conclusion, and so on, and then use the projector as output in the game, will play a role in the stadium atmosphere.

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.