1 / 9

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

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

Download Presentation

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

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. הרצאה 11 – חלק א מבוא למדעי המחשב לתעשייה וניהול

  2. Structure

  3. Structure • נגדיר מבנה structure עבור חבר מועדון בעל הפרטים הבאים: • שם • טלפון • גיל • Structuremember • Dim name AsString • Dim phone AsString • Dim age AsInteger • EndStructure

  4. דוגמא 9 – הגדרה ושימוש ב structure ModuleModule1 StructureMember Dim name AsString Dim phone AsString Dim age AsInteger EndStructure Sub Main() Dim x AsMember x.name = "Chen" x.phone = "08-9123232" x.age = 18 Console.WriteLine("{0}, {1}, {2}", x.name, x.phone, x.age) EndSub EndModule

  5. דוגמא 10 – הגדרה ושימוש ב structure (עם קלט) ModuleModule1 StructureMember Dim name AsString Dim phone AsString Dim age AsInteger EndStructure Sub Main() Dim x AsMember x.name = Console.ReadLine() x.phone = Console.ReadLine() x.age = Console.ReadLine() Console.WriteLine("{0}, {1}, {2}", x.name, x.phone, x.age) EndSub EndModule

  6. דוגמא 11 –structure במערך ModuleModule1 StructureMember Dim name AsString Dim phone AsString Dim age AsInteger EndStructure Sub Main() Dim x(2) AsMember Fori = 0 Tox.Length - 1 x(i).name = Console.ReadLine() x(i).phone = Console.ReadLine() x(i).age = Console.ReadLine() Next Fori = 0 Tox.Length - 1 Console.WriteLine("{0},{1},{2}",x(i).name,x(i).phone,x(i).age) Next EndSub EndModule

  7. דוגמא 12 –structure במערך, מציאת ערך מינימלי והדפסתו StructureMember Dim name AsString Dim phone AsString Dim age AsInteger EndStructure Sub Main() Dimx(4) AsMember Fori = 0 Tox.Length - 1 x(i).name = Console.ReadLine() x(i).phone = Console.ReadLine() x(i).age = Console.ReadLine() Next Dim min AsInteger = 120 Fori = 0 Tox.Length - 1 If x(i).age < min Then min = x(i).age EndIf Next Console.WriteLine("youngest age is: " & min) EndSub

  8. דוגמא 13 – מציאת ערך מינימלי והדפסת שדה אחר של בעל הערך ModuleModule1 StructureMember Dim name AsString Dim phone AsString Dim age AsInteger EndStructure Sub Main() Dim x(2) AsMember Fori = 0 Tox.Length - 1 x(i).name = Console.ReadLine() x(i).phone = Console.ReadLine() x(i).age = Console.ReadLine() Next המשך בשקף הבא...

  9. דוגמא 13 – המשך Dimmin AsInteger = 120 Dim n AsString = "" Fori = 0 Tox.Length - 1 If x(i).age < min Then min = x(i).age n = x(i).name EndIf Next Console.WriteLine("name of youngest is: " & n) EndSub EndModule

More Related