Saturday
May 18, 2013

Homework Help: VBScript

Posted by Pete on Saturday, March 13, 2010 at 10:29am.

Option Explicit
Dim Answer
Dim aScores()
Dim intNumScores

' Initialize Answer so loop will enter and execute
Answer = vbOK
Do While Answer = vbOK

intNumScores = CInt(InputBox("How many scores will you be entering?", "Enter

Number Of Scores"))

ReDim aScores(intNumScores)
Dim ii
Dim sngSum
Dim Score

' Initialize the sum to 0
sngSum = 0
For ii = 0 To intNumScores -1
Score = InputBox("Enter Score #" & ii + 1, "Enter Score")
' If user just hit enter, exit.
If Score = "" Then
Exit For
End If

' Store value in array
aScores(ii) = CSng(Score)

' Add new value to the running sum
sngSum = sngSum + aScores(ii)
Next

' If user entered a blank, exit
If Score = "" Then
Exit Do
End If

' Compute Average
Dim sngAvg
sngAvg = sngSum / intNumScores


Answer = MsgBox("The Average Score is: " & sngAvg & " Continue?", 65,

"Average")

Loop

Please can you check for me?

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

visual basic - here is my source code for my program im trying to convert 10 ...
visual basic - Cant get my message dialog box to display anbody see waht wrong ...
visual basic - Im trying to get this program to average three number having a ...
programming - I am supposed to modify this program so it begins by asking the ...
Computer Science - I need to write a program to solve for the following: Suppose...
Programming - Write a program that allows the user to display a budget as a ...
Computer programming - The code below is supposed to calculate the average for a...
programming - write a program that maintains two parallel arrays. after th ...
VBA EXCEL - I was wondering I have 3 input boxes and with one of them I need the...
Programming - I’m using VB 2008. I need to write a simple program that ...

For Further Reading

Search
Members
Community