9
בבבב בבבבב בבבבב בבבבבבב בבבבבב בבבבב11 – בבב ב

מבוא למדעי המחשב לתעשייה וניהול

Embed Size (px)

DESCRIPTION

הרצאה 11 – חלק א. מבוא למדעי המחשב לתעשייה וניהול. Structure. Structure. נגדיר מבנה structure עבור חבר מועדון בעל הפרטים הבאים: שם טלפון גיל. Structure member Dim name As String Dim phone As String Dim age As Integer End Structure. דוגמא 9 – הגדרה ושימוש ב structure. - PowerPoint PPT Presentation

Citation preview

Page 1: מבוא למדעי המחשב לתעשייה וניהול

המחשב למדעי מבואוניהול לתעשייה

א – 11הרצאה חלק

Page 2: מבוא למדעי המחשב לתעשייה וניהול

Structure

Page 3: מבוא למדעי המחשב לתעשייה וניהול

Structure

מבנה בעל structureנגדיר מועדון חבר עבור: הבאים הפרטים

שםטלפוןגיל

Structure member Dim name As String Dim phone As String Dim age As IntegerEnd Structure

Page 4: מבוא למדעי המחשב לתעשייה וניהול

Module Module1

Structure Member

Dim name As String

Dim phone As String

Dim age As Integer

End Structure

Sub Main()

Dim x As Member

x.name = "Chen"

x.phone = "08-9123232"

x.age = 18

Console.WriteLine("{0}, {1}, {2}", x.name, x.phone, x.age)

End Sub

End Module

ב – 9דוגמא ושימוש structureהגדרה

Page 5: מבוא למדעי המחשב לתעשייה וניהול

Module Module1

Structure Member

Dim name As String

Dim phone As String

Dim age As Integer

End Structure

Sub Main()

Dim x As Member

x.name = Console.ReadLine()

x.phone = Console.ReadLine()

x.age = Console.ReadLine()

Console.WriteLine("{0}, {1}, {2}", x.name, x.phone, x.age)

End Sub

End Module

ב – 10דוגמא ושימוש (structureהגדרה קלט ) עם

Page 6: מבוא למדעי המחשב לתעשייה וניהול

Module Module1

Structure Member

Dim name As String

Dim phone As String

Dim age As Integer

End Structure

Sub Main()

Dim x(2) As Member

For i = 0 To x.Length - 1

x(i).name = Console.ReadLine()

x(i).phone = Console.ReadLine()

x(i).age = Console.ReadLine()

Next

For i = 0 To x.Length - 1

Console.WriteLine("{0},{1},{2}",x(i).name,x(i).phone,x(i).age)

Next

End Sub

End Module

במערך structure –11דוגמא

Page 7: מבוא למדעי המחשב לתעשייה וניהול

Structure Member

Dim name As String

Dim phone As String

Dim age As Integer

End Structure

Sub Main()

Dim x(4) As Member

For i = 0 To x.Length - 1

x(i).name = Console.ReadLine()

x(i).phone = Console.ReadLine()

x(i).age = Console.ReadLine()

Next

Dim min As Integer = 120

For i = 0 To x.Length - 1

If x(i).age < min Then

min = x(i).age

End If

Next

Console.WriteLine("youngest age is: " & min)

End Sub

, structure –12דוגמא והדפסתו מינימלי ערך מציאת במערך

Page 8: מבוא למדעי המחשב לתעשייה וניהול

Module Module1

Structure Member

Dim name As String

Dim phone As String

Dim age As Integer

End Structure

Sub Main()

Dim x(2) As Member

For i = 0 To x.Length - 1

x(i).name = Console.ReadLine()

x(i).phone = Console.ReadLine()

x(i).age = Console.ReadLine()

Next

הבא בשקף ...המשך

הערך – 13דוגמא בעל של אחר שדה והדפסת מינימלי ערך מציאת

Page 9: מבוא למדעי המחשב לתעשייה וניהול

Dim min As Integer = 120

Dim n As String = ""

For i = 0 To x.Length - 1

If x(i).age < min Then

min = x(i).age

n = x(i).name

End If

Next

Console.WriteLine("name of youngest is: " & n)

End Sub

End Module

המשך – 13דוגמא