מבני בקרה מבוא לתכנות למנע " ס - שבוע מספר 3 - מאיר קומר - סמסטר ב ' - תשס " ו הסתעפות “ אם השמאל ואימנה ואם הימין ואשמאילה ”

Slides:



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

חיפוש בינה מלאכותית אבי רוזנפלד. סוגי חיפוש כלליים UNINFORMED SEARCH -- חיפושים לא מיודעים במרחי מצבים – BFS – DFS INFORMED SEARCH – חיפושים מיודעים –
©Silberschatz, Korth and Sudarshan4.1Database System Concepts סכימה לדוגמא.
מחרוזות של תווים. מבוא לתכנות למנע"ס - שבוע מספר 5 - מאיר קומר - סמסטר ב' - תשס"ו מחרוזות - Strings Dim s As String s = “hello” s = s & “kita” או s =
מצגת מיקמק מבית nolamik הפקות.
If – Case Programs CSC Arwa © 2008.
תכנות תרגול 4 שבוע : לולאות while לולאות while while (condition) { loop body } במקרה של קיום התנאי מתבצע גוף הלולאה ברגע שהתנאי לא מתקיים נצא.
תכנות תרגול 2 שבוע : שבוע שעבר כתבו תוכנית המגדירה שלושה משתנים מאתחלת אותם ל 1 2 ו 3 ומדפיסה את המכפלה שלהם את ההפרש שלהם ואת הסכום שלהם.
סוגי מידע / משתנים ד " ר אבי רוזנפלד. סוגאורךטווח Boolean1 Bit0,1 Byte1 byte0-255 Char 2 bytes תו Decimal16 bytes0 through +/-79,228,162,514,264,337,593,543,950,335.
תכנות ב C#. דוגמא לפלט using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void.
תרגילים. גדול, קטן, וממוצע מקובץ Imports System.IO Module Module1 Sub Main() Dim readnum As StreamReader readnum = _ My.Computer.FileSystem.OpenTextFileReader.
מבוא למדעי המחשב תרגול 4 שעת קבלה : יום שני 11:00-12:00 דוא " ל :
1 מבוא למדעי המחשב ביטויים. 2 ביטויים expressions ביטויים (expressions) הינם יצורים תחביריים בעלי טיפוס וערך. הגדרה אינדוקטיבית של ביטויים : קבועים הם.
תכנות תרגול 6 שבוע : תרגיל שורש של מספר מחושב לפי הסדרה הבאה : root 0 = 1 root n = root n-1 + a / root n-1 2 כאשר האיבר ה n של הסדרה הוא קירוב.
אלגוריתמים, WINDOWS והחיים. מבוא למדעי המחשב - מאיר קומר - סמסטר א '- תשס " ט - שיעור מספר 7 מיוןsort.
פתרון תרגיל 10. שאלה #1 Module Module1 Sub Main() Dim maarach(9), zoogy(4), ezoogy(5) As Integer Dim i, counter, j As Integer For i = 0 To 9 Console.WriteLine("please.
פתרון בוחן הכיתה. שאלה #1 Module Module1 Sub Main() Dim x, z As Integer x = Console.ReadLine() z = Console.ReadLine() If (x = 0) Then Console.WriteLine("Error")
פתרון תרגיל 11. שאלה #1 Module Module1 Sub Main() Dim x(10, 10) As Integer Dim i, j As Integer For i = 1 To 10 For j = 1 To 10 x(i, j) = i * j Console.Write("
מערכים מבוא לתכנות למנע"ס - שבוע מספר 8 - מאיר קומר - סמסטר ב' - תשס"ו והנה בעיה כתוב תוכנית אשר תקלוט 36 מספרים ותדפיס כמה מתוכם גדולים יותר מהממוצע.
מבוא כללי למדעי המחשב תרגול 3. לולאות while לולאות while while (condition) { loop body } במקרה של קיום התנאי מתבצע גוף הלולאה ברגע שהתנאי לא מתקיים נצא.
מבני בקרה לולאות. שאלה #1 שאלה ב' – תכתוב תוכנה הכותבת את תפריט הבאה Type 1 to find the area of a circle Type 2 to find the circumference of a circle.
מבוא למדעי המחשב תרגול מספר.
מבני בקרה לולאות. פקודת CASE Module Module1 Sub Main() Dim input As Char input = Console.ReadLine() Select Case (input) Case "A" Console.WriteLine("A.
אלגוריתמי חיפוש. Brute Force Module Module1 Function BruteForce(ByRef x() As Integer, ByRef item As Integer) As Integer Dim i As Integer For i = 0 To.
מבוא למדעי המחשב תרגול 3 שעת קבלה : יום שני 11:00-12:00 דוא " ל :
תרגול 5: ביטויים לוגיים ומשפטי תנאי (חזרה והרחבה)
1 compute תנאים פשוטים בעזרת compute לוגי לדוגמא: compute q1 = w > 80. Freq var = q1.
פתרון תרגילים #9. דוגמה פשוטה #1 Module Module1 Sub Main() Dim x As String x = Console.ReadLine For i = 1 To x.Length() - 1 Step 2 Console.WriteLine(x(i))
Markov Decision Processes (MDP) תומר באום Based on ch. 14 in “Probabilistic Robotics” By Thrun et al. ב"הב"ה.
מערכים דו ממדי ו STRUCTS פונקציות בוליאנית Module Module1 Function Flip(ByVal word1 As String) As Boolean Dim i As Integer For i = 0 To word1.Length()
מתמטיקה בדידה תרגול 2.
A. Frank File Organization Hardware Size Parameters.
פונקציות. פונקציות מוכרות Imports System.Math Module Module1 Sub Main() Dim x As Decimal = Math.Abs(-10.4) Dim y As Decimal Console.WriteLine("I will.
= 9 = 8 = 12 = 19 = 2 = 3 = 17 = 5 = 11 = 5.
الحلقات for For i =1 To x step -2 …………. Next DO while (شرط) …………. Loop DO …………. Loop while (شرط) الحلقة Do while.
Structure. מה לומדים היום ? דרך לבנות מבנה נתונים בסיסי – Structure מייצר " טיפוס " חדש מתאים כאשר רוצים לאגד כמה משתנים יחד דוגמאות : עובד : שם, טלפון,
1 Conditional statements Dept. of Computer Engineering Faculty of Engineering, Kasetsart University Bangkok, Thailand.
מבנה נתונים ואלגוריתמים ) לשעבר - עיבוד מידע( ד"ר אבי רוזנפלד ד"ר אריאלה ריכרדסון.
26/10/ Selection Nested If structures & Complex Multiple Conditions.
מבוא למדעי המחשב לתעשייה וניהול הרצאה 7. סברוטינות subroutines.
22/11/ Selection If selection construct.
Lesson 6 Selection Structures. Example program //This will convert a numeric grade into a letter grade import TerminalIO.KeyboardReader; public class.
מחסנית ותור Stacks and Queues. מחסנית Stack מחסנית - Stack ADT סוג של מערך מוגבל מהיר מאוד ותופס מעט זיכרון שימוש ב LIFO – LIFO (Last In, First Out)
הרצאה 3 מבוא למדעי המחשב לתעשייה וניהול הודעות : הודעות : או דרך moodle – ושם לפנות ל : אתר מכון טל החומר.
מבנה נתונים ואלגוריתמים ) לשעבר - עיבוד מידע( ד"ר אבי רוזנפלד ד"ר אריאלה ריכרדסון.
مسألة أكتب برنامجاً يقوم بقراءة عددين و إظهار رسالة تفيد بأن أحد العددين هو المضاعف النوني للعدد الآخر و في حال عدم كون أي من العددين مضاعفاً للآخر يظهر.
מבוא למדעי המחשב לתעשייה וניהול הרצאה 12. ספריות.
Chapter One Lesson Three DATA TYPES ©
A: A: double “4” A: “34” 4.
Computing with C# and the.NET Framework Chapter 4 More Control Structures and Types ©2003, 2011 Art Gittleman.
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
מבוא למדעי המחשב לתעשייה וניהול הרצאה 6. מפעל השעווה – לולאות  עד עכשיו  טיפלנו בייצור נרות מסוג אחד, במחיר אחיד  למדנו להתמודד עם טיפול במקרים שונים.
מבנה נתונים ואלגוריתמים ) לשעבר - עיבוד מידע( ד"ר אבי רוזנפלד ד"ר אריאלה ריכרדסון.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
אלגוריתמי חיפוש. Brute Force Module Module1 Function BruteForce(ByRef x() As Integer, ByRef item As Integer) As Integer Dim i As Integer For i = 0 To.
C# and the .NET Framework
מבוא למדעי המחשב לתעשייה וניהול
Basics programming concepts-2
البرمجة بلغة فيجول بيسيك
תירגול 14: מבני נתונים דינאמיים
Review Operation Bingo
البرمجة بلغة فيجول بيسك ستوديو
ניתוח מערכות מידע תכנות ב C#
מבוא לתכנות בWINDOWS ב#C
מחסנית ותור Stacks and Queues.
Computer Programming תרגול 3 Summer 2016
Engineering Programming A
VB.Net Programming Console Application
VB.Net Programming Console Application
C# Revision Cards Data types
Presentation transcript:

מבני בקרה

מבוא לתכנות למנע " ס - שבוע מספר 3 - מאיר קומר - סמסטר ב ' - תשס " ו הסתעפות “ אם השמאל ואימנה ואם הימין ואשמאילה ”

מבוא לתכנות למנע " ס - שבוע מספר 2 - מאיר קומר - סמסטר ב ' - תשס " ו סדרה - sequence s1s1 s2s2

מבוא לתכנות למנע " ס - שבוע מספר 2 - מאיר קומר - סמסטר ב ' - תשס " ו בחירה - selection תנאי s1s1 s2s2

מבוא לתכנות למנע " ס - שבוע מספר 2 - מאיר קומר - סמסטר ב ' - תשס " ו בצע עד איטראציה - iteration בצע עד s1s1 תנאי

מבוא לתכנות למנע " ס - שבוע מספר 2 - מאיר קומר - סמסטר ב ' - תשס " ו כל עוד איטראציה - iteration כל עוד s1s1 תנאי

מבוא לתכנות למע " ס - מאיר קומר - סמסטר ב '- תשס " ו - מצגת סיכום קצת ייחס ! A = B A > B A >= B A <= B A <> B

מבוא לתכנות למנע " ס - שבוע מספר 3 - מאיר קומר - סמסטר ב ' - תשס " ו הסתעפות If תנאי Then פקודה If a = 0 Then b =7 אפשר גם If a = 0 Then b =7 End If תנא י s1

דוגמא קצרה Module Module1 Sub Main() Dim x As Boolean = 2 > 2 Dim y As Boolean = 1 Console.WriteLine(x) 'What will this do? Console.WriteLine(y) 'What will this do? Console.ReadKey() End Sub End Module

לוגיקה פשוטה Module Module1 Sub Main() Dim x As Char x = Console.ReadLine() If (x = "A") Then Console.WriteLine("A is for Apple") ElseIf (x = "B") Then Console.WriteLine("B is for Boy") Else Console.WriteLine("Not defined") End If Console.ReadKey() End Sub End Module

מה זה יעשה ? Module Module1 Sub Main() Dim grade As Integer grade = Console.ReadLine() If (grade >= 90) Then Console.WriteLine("you got an A") ElseIf (grade >= 80) Then Console.WriteLine("you got an B") ElseIf (grade >= 70) Then Console.WriteLine("you got an C") ElseIf (grade >= 60) Then Console.WriteLine("you got an D") Else Console.WriteLine("you failed") End If Console.ReadKey() End Sub End Module

מבוא לתכנות למנע " ס - שבוע מספר 3 - מאיר קומר - סמסטר ב ' - תשס " ו פעולות לוגית זכור ! שקר =0 AND OR NOT

Shakespeare Module Module1 Sub Main() Dim ToB As Boolean = True 'Or false! Dim question As Boolean = ToB Or Not ToB Console.WriteLine("That is the question " & question) Console.ReadKey() End Sub End Module

מבוא לתכנות למנע " ס - שבוע מספר 3 - מאיר קומר - סמסטר ב ' - תשס " ו AND A AND BBA True FalseTrue False True False

מבוא לתכנות למנע " ס - שבוע מספר 3 - מאיר קומר - סמסטר ב ' - תשס " ו OR A OR BBA True FalseTrue False True False

זה לא יעבוד למה ??? Module Module1 Sub Main() Dim grade As Integer grade = Console.ReadLine() If (grade >= 90) Then Console.WriteLine("you got an A") End If If (grade >= 80) Then Console.WriteLine("you got an B") End If If (grade >= 70) Then Console.WriteLine("you got an C") End If If (grade >= 60) Then Console.WriteLine("you got an D") End If If (grade < 60) Then Console.WriteLine("you failed") End If Console.ReadKey() End Sub End Module

זה הכי טוב למה ??? Module Module1 Sub Main() Dim grade As Integer grade = Console.ReadLine() If (grade >= 90 And grade <= 90) Then Console.WriteLine("you got an A") End If If (grade >= 80 And grade < 90) Then Console.WriteLine("you got an B") End If If (grade >= 70 And grade < 80) Then Console.WriteLine("you got an C") End If If (grade >= 60 And grade < 70) Then Console.WriteLine("you got an D") End If If (grade < 60) Then Console.WriteLine("you failed") End If Console.ReadKey() End Sub End Module

זה הרבה יותר טוב למה ??? Module Module1 Sub Main() Dim grade As Integer grade = Console.ReadLine() If (grade >= 90) Then Console.WriteLine("you got an A") ElseIf (grade >= 80) Then Console.WriteLine("you got an B") ElseIf (grade >= 70) Then Console.WriteLine("you got an C") ElseIf (grade >= 60) Then Console.WriteLine("you got an D") Else Console.WriteLine("you failed") End If Console.ReadKey() End Sub End Module

IF בתוך IF Module Module1 Sub Main() Dim x, y As String x = Console.ReadLine() If (x = "A") Then Console.WriteLine("Now enter something else") y = Console.ReadLine If (y = "B") Then Console.WriteLine("Good") ‘Console.ReadKey() why is this bad? Else Console.WriteLine("Bad") ‘Console.ReadKey() why is this bad? End If Else Console.WriteLine("Not Defined") ‘Console.ReadKey() why is this bad? End If Console.ReadKey() End Sub End Module

פונקציות מתמטיות Imports System.Math Module Module1 Sub Main() Dim x As Decimal = Math.Abs(-10.4) Dim y As Decimal Console.WriteLine("I will find the square root of a number") y = Console.ReadLine() Console.WriteLine("The absolute value is " & x) Console.WriteLine("The value of PI is " & Math.PI) Console.WriteLine("The square root of " & y & " is " & Math.Sqrt(y)) Console.WriteLine("2 to the 4.5 power is " & Math.Pow(2, 4.5)) Console.ReadKey() End Sub End Module

מבוא לתכנות למנע " ס - שבוע מספר 3 - מאיר קומר - סמסטר ב ' - תשס " ו סיכום אופרטור לוגי מחזיר ערך אמת או שקר בלבד אופרטור וגם ( AND) מחזיר אמת אם שני הביטויים משני הצדדים של האופרטור אמת אופרטור או ( OR ) מחזיר אמת אם אחד מהביטויים משני הצדדים של האופרטור אמת אופרטור שלילה הלוגי ( NOT ) הופך את ערכו הלוגי של ביטוי הלוגי מימינו. ביטוי אמת מחזיר את הערך 1 וביטוי שקר מחזיר 0