HW#4.3 - Print #2, "initial...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework#4 Problem 3 Option Explicit Sub myprog() Dim W(10, 20) As Integer, r As Integer, c As Integer, sum As Single Dim N As Integer, S As Integer, Ave As Single, P(10, 20) As Single Open "\Users\Mateusz\Desktop\Widget2004.dat" For Input As #1 Input #1, N Input #1, S For r = 1 To N For c = 1 To S Input #1, W(r, c) sum = sum + W(r, c) Ave = sum / (N * S) P(r, c) = W(r, c) / Ave Next c Next r Close #1 Open "C:\Users\Mateusz\Desktop\output.dat" For Output As #2
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Print #2, "initial samples" For r = 1 To 3 For c = 1 To 4 Print #2, W(r, c) & " "; Next c Print #2, W(r, c) Next r Print #2, "Average Fracture Stress=" & Ave Print #2, Print #2, "Percent Fracture Stress" For r = 1 To 3 For c = 1 To 4 Print #2, Round(P(r, c), 2) & " "; Next c Print #2, Round(P(r, c), 2) Next r Close #2 End Sub...
View Full Document

Ask a homework question - tutors are online