منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[VB.NET] اريد كود للبرنامج التالي بطريقة general procedures - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [VB.NET] اريد كود للبرنامج التالي بطريقة general procedures (/showthread.php?tid=18261)



اريد كود للبرنامج التالي بطريقة general procedures - a_abdullah - 05-12-16

هذا السؤال لمن يستطيع فهمه  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.



RE: اريد كود للبرنامج التالي بطريقة general procedures - amgad525 - 05-12-16

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 




RE: اريد كود للبرنامج التالي بطريقة general procedures - a_abdullah - 05-12-16

(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(",")