منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : اريد كود للبرنامج التالي بطريقة general procedures
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
هذا السؤال لمن يستطيع فهمه  Huh


Write a VB program that takes an array as input an integer from the user and displays the maximum and minimum value. This processing must be in a function procedure and the result should be displayed in the event procedure (button click).also you must display even numbers in this array by subroutine procedure.
sample TextBox1 text: 2,3,4,5,6,7

(event procedure (button click
PHP كود :
Private Sub Button1_Click(sender As System.ObjectAs System.EventArgsHandles Button1.Click

    Dim splt
() As String Me.TextBox1.Text.Split(",")

 
   Dim arr(splt.Count 1) As Integer
    For i 
0 To splt.Length 1
        arr
(i) = Val(splt(i))
 
   Next


    Label1
.Text GetArrayMaximumValue(arr)

 
   Label2.Text GetArrayMinimumValue(arr)

 
   DisplayArrayEvenNumbers(arr)

End Sub 



function procedure
Maximum
PHP كود :
Function GetArrayMaximumValue(arr As Integer()) As Integer
    Return arr
.Max()
End Function 
OR
PHP كود :
Function GetArrayMaximumValue(arr As Integer()) As Integer
    Dim mx 
As Integer Integer.MinValue
    For i 
0 To arr.Length 1
        If arr
(i) > mx Then
            mx 
arr(i)
 
       End If
 
   Next
    Return mx
End 
Function 



function procedure
Minimum
PHP كود :
Function GetArrayMinimumValue(arr As Integer()) As Integer
    Return arr
.Min()
End Function 
OR
PHP كود :
Function GetArrayMinimumValue(arr As Integer()) As Integer
    Dim mn 
As Integer Integer.MaxValue
    For i 
0 To arr.Length 1
        If arr
(i) < mn Then
            mn 
arr(i)
 
       End If
 
   Next
    Return mn
End 
Function 



display even numbers
subroutine procedure
PHP كود :
Sub DisplayArrayEvenNumbers(arr As Integer())
 
   For i 0 To arr.Length 1
        If arr
(iMod 2 0 Then
            Label3
.Text Label3.Text arr(i) & " "
 
       End If
 
   Next
End Sub 

(05-12-16, 01:21 PM)amgad525 كتب : [ -> ]sample TextBox1 text: 2,3,4,5,6,7

(event procedure (button click
PHP كود :
Private Sub Button1_Click(sender As System.ObjectAs System.EventArgsHandles Button1.Click

    Dim splt
() As String Me.TextBox1.Text.Split(",")

 
   Dim arr(splt.Count 1) As Integer
    For i 
0 To splt.Length 1
        arr
(i) = Val(splt(i))
 
   Next


    Label1
.Text GetArrayMaximumValue(arr)

 
   Label2.Text GetArrayMinimumValue(arr)

 
   DisplayArrayEvenNumbers(arr)

End Sub 



function procedure
Maximum
PHP كود :
Function GetArrayMaximumValue(arr As Integer()) As Integer
    Return arr
.Max()
End Function 
OR
PHP كود :
Function GetArrayMaximumValue(arr As Integer()) As Integer
    Dim mx 
As Integer Integer.MinValue
    For i 
0 To arr.Length 1
        If arr
(i) > mx Then
            mx 
arr(i)
 
       End If
 
   Next
    Return mx
End 
Function 



function procedure
Minimum
PHP كود :
Function GetArrayMinimumValue(arr As Integer()) As Integer
    Return arr
.Min()
End Function 
OR
PHP كود :
Function GetArrayMinimumValue(arr As Integer()) As Integer
    Dim mn 
As Integer Integer.MaxValue
    For i 
0 To arr.Length 1
        If arr
(i) < mn Then
            mn 
arr(i)
 
       End If
 
   Next
    Return mn
End 
Function 



display even numbers
subroutine procedure
PHP كود :
Sub DisplayArrayEvenNumbers(arr As Integer())
 
   For i 0 To arr.Length 1
        If arr
(iMod 2 0 Then
            Label3
.Text Label3.Text arr(i) & " "
 
       End If
 
   Next
End Sub 

بس عشان افهم ليش حطيت هنا me 
 Dim splt() As String = Me.TextBox1.Text.Split(",")