Help Visual Basic 6.0 Find the Highes and Lowest integer - PINOYDEN


Go Back   PINOYDEN > PC Zone > Programming

Welcome to PinoyDen Forums.

You are currently browsing our forum as a guest, please consider registering to get full access to all of our forum features, download free games, get help for your pc and cellphone problems and learn new mobile tricks like how to browse the internet using your cellphone for free. All that and more, so what are you waiting for, JOIN us now!!!! Click here to register...
 Topic: Help Visual Basic 6.0 Find the Highes and Lowest integer  (Read 125 times)
0 Members and 1 Guest are viewing this topic.
Pages: [1]   Go Down
01-03-13 06:11 AM
  • Newbie
  • Offline
 
Posts: 3
Thank You: 0
Reputation: 0
jcarlo5o9 has no influence.barely matters.is working their way up.might someday be someone...is on the verge of being accepted.is a rising star!has a powerful will.is a force to reckon with.has great potential!has an aura about them.is leading the good life!is awe-inspiring!
example:
Enter ten integer: 1 2 3 4 5 6 7 8 9 10
Smallest integer: 1
Highest integer: 10
Tnx sa makakatulong
Reply #1
01-03-13 08:23 AM
  • Semi-Newbie
  • *
  • Offline
 
Posts: 9
Thank You: 1
Reputation: 0
syncster has no influence.barely matters.is working their way up.might someday be someone...is on the verge of being accepted.is a rising star!has a powerful will.is a force to reckon with.has great potential!has an aura about them.is leading the good life!is awe-inspiring!
Max and Min functions exists on excel applications, unfortunately it does'nt in vb6.0.
So kelangan po gawa ka ng function for that.

First here is the function for Min:

Code: [Select]
Function Min(ParamArray avValues() As Variant) As Variant
    Dim vThisItem As Variant, vThisElement As Variant
   
    On Error Resume Next
    For Each vThisItem In avValues
        If IsArray(vThisItem) Then
            For Each vThisElement In vThisItem
                Min = Min(vThisElement, Min)
            Next
        Else
            If vThisItem < Min Then
                If Not IsEmpty(vThisItem) Then
                    Min = vThisItem
                End If
            ElseIf IsEmpty(Min) Then
                Min = vThisItem
            End If
        End If
    Next
    On Error GoTo 0
End Function

Ganito po paggamit nyan,
Example:
   Min(1,3,5,6,2,10)
   -Ang return value nyan ay 1.


Next naman ay ang Max function para sa maximum value.

Code: [Select]
Function Max(ParamArray avValues() As Variant) As Variant
    Dim vThisItem As Variant, vThisElement As Variant
   
    On Error Resume Next
    For Each vThisItem In avValues
        If IsArray(vThisItem) Then
            For Each vThisElement In vThisItem
                Max = Max(vThisElement, Max)
            Next
        Else
            If vThisItem > Max Then
                If Not IsEmpty(vThisItem) Then
                    Max = vThisItem
                End If
            ElseIf IsEmpty(Max) Then
                Max = vThisItem
            End If
        End If
    Next
    On Error GoTo 0
End Function

Ang usage nya is almost the same gamit ka lang ng max:
Example:
   Max(-1, 3, 5, 20, 12)
 
  -Ang return value naman nyan ay 20..

So hope this helps! Gudluck...
Pages: [1]   Go Up
 


Related Topics
Subject Started by Replies Views Last post
Help Sa Visual Basic
Academic Zone
Lyons 1 390 Last post 01-17-11 07:05 PM
by ryanroch
VISUAL BASIC .NET?
Programming
acgilbert 2 390 Last post 08-21-11 06:18 PM
by BLOCKCIRCUIT03
Visual Basic 6: Can't find DAO350.dll
PC Help & Support
chrischan 10 423 Last post 08-25-11 06:08 AM
by chrischan
help me about visual basic
Programming
nashmarshal 0 131 Last post 04-28-12 12:26 PM
by nashmarshal
visual basic
Programming
bulagaga 0 113 Last post 10-01-12 02:43 AM
by bulagaga

All dates are GMT+8:00. The date now is 05-23-13 04:51 AM
WWW.PINOYDEN.COM.PH does not store any files on it's server, we are just indexing other sites contents!
WWW.PINOYDEN.COM.PH [Ang Tambayan ng pinoy!] © copyright 2008-2009 All Rights Reserved.
Contents published on www.PinoyDen.com.ph requires permission for reprint.

Page created in 0.147 seconds with 22 queries.