Académique Documents
Professionnel Documents
Culture Documents
Math
Module Module1
Sub Main()
'*********************************************************
'GENG1002 Midterm Test
'C3206008
'Hussain, Faizan
'*********************************************************
'Variables
Dim n As Integer 'Number of points
Dim header As String 'header
Const nmax = 56 'Maximum size of array
Dim x(nmax - 1) As Double 'x coordinate
Dim y(nmax - 1) As Double 'y coordinate
Dim filename As String 'Input file name
Dim ISRS As Double
Dim i As Integer 'For loop index
'Writes the header and the ISRS to an output file named "results.dat
WriteLine(20, header)
WriteLine(20, "The value of ISRS=")
WriteLine(20, ISRS)
End Sub
Function Find_ISRS(ByVal n As Integer, ByVal x() As Double, ByVal y() As Double)
'Inputs n, x, y
'Outputs ISRS
For i = 1 To n - 1
topsum = topsum + (x(i) - x(i - 1)) ^ 2
Next
For i = 0 To n - 1
bottomsum = bottomsum + Sqrt(y(i) / x(i))
Next
Return Sqrt(topsum) / bottomsum ' Uses topsum and bottomsum to find ISRS
End Function
End Module
Console Screen
Output screen