Drop lowest value from Array and Resize array - VB 2003
My goal is to to reaverage the grades after the lowest has been dropped. I am working with a five element array. I would like to find the lowest value in the array and remove it from the array then resize the array with the elements that remain.
Since I have sorted the array, I know that I would like to remove the first element in the array since it is the lowest. Below is the code that I have tried but cannot get it to work.
Thanks for your help!
For i As Integer = 1 To 5
Console.WriteLine("Enter grade: " & i)
grades(i) = Console.ReadLine
sum = grades(i) + sum
average = sum / UBound(grades)
' i was using this code to replace the first element with nothing
'then reaverage the grade with only 4 grades instead of five
grades(1) = Nothing
newAverage = sum / UBound(grades) - 1
By angelito in forum VB Classic
Last Post: 11-21-2005, 06:16 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL