סוגי מידע / משתנים ד " ר אבי רוזנפלד. סוגאורךטווח Boolean1 Bit0,1 Byte1 byte0-255 Char 2 bytes תו Decimal16 bytes0 through +/-79,228,162,514,264,337,593,543,950,335.

Slides:



Advertisements
Similar presentations
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Advertisements

Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
מחרוזות של תווים. מבוא לתכנות למנע"ס - שבוע מספר 5 - מאיר קומר - סמסטר ב' - תשס"ו מחרוזות - Strings Dim s As String s = “hello” s = s & “kita” או s =
תכנות ב 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.
1 9/8/08CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
1 9/20/06CS150 Introduction to Computer Science 1 Review: Exam 1.
אלגוריתמים, WINDOWS והחיים. מבוא למדעי המחשב - מאיר קומר - סמסטר א '- תשס " ט - שיעור מספר 7 מיוןsort.
מבני בקרה מבוא לתכנות למנע " ס - שבוע מספר 3 - מאיר קומר - סמסטר ב ' - תשס " ו הסתעפות “ אם השמאל ואימנה ואם הימין ואשמאילה ”
פתרון תרגיל 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 מספרים ותדפיס כמה מתוכם גדולים יותר מהממוצע.
מבני בקרה לולאות. פקודת 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.
פתרון תרגילים #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))
מערכים דו ממדי ו STRUCTS פונקציות בוליאנית Module Module1 Function Flip(ByVal word1 As String) As Boolean Dim i As Integer For i = 0 To word1.Length()
פונקציות. פונקציות מוכרות Imports System.Math Module Module1 Sub Main() Dim x As Decimal = Math.Abs(-10.4) Dim y As Decimal Console.WriteLine("I will.
Structure. מה לומדים היום ? דרך לבנות מבנה נתונים בסיסי – Structure מייצר " טיפוס " חדש מתאים כאשר רוצים לאגד כמה משתנים יחד דוגמאות : עובד : שם, טלפון,
Reading and Writing to the Console Svetlin Nakov Telerik Corporation
Microsoft Access Using Visual Basic Routines. Visual Basic Datatypes Boolean Byte Currency Date Double Integer Long Object Single String Variant Hyperlink.
1.3 Console Input And Output academy.zariba.com 1.
Tutorial 6 Introducing Variables, Memory Concepts & Arithmetic.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
מבנה נתונים ואלגוריתמים ) לשעבר - עיבוד מידע( ד"ר אבי רוזנפלד ד"ר אריאלה ריכרדסון.
Introduction to Pascal The Basics of Program writing.
1 Chapter 10 Additional Control Structures and Exceptions.
Count and add list of numbers From user input and from file.
מבוא למדעי המחשב לתעשייה וניהול הרצאה 7. סברוטינות subroutines.
COMPUTER PROGRAMMING I SUMMER Apply operators and Boolean expressions.
הרצאה 3 מבוא למדעי המחשב לתעשייה וניהול הודעות : הודעות : או דרך moodle – ושם לפנות ל : אתר מכון טל החומר.
מבנה נתונים ואלגוריתמים ) לשעבר - עיבוד מידע( ד"ר אבי רוזנפלד ד"ר אריאלה ריכרדסון.
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
מבוא למדעי המחשב לתעשייה וניהול הרצאה 12. ספריות.
Chapter One Lesson Three DATA TYPES ©
Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3.
מבוא למדעי המחשב לתעשייה וניהול הרצאה 6. מפעל השעווה – לולאות  עד עכשיו  טיפלנו בייצור נרות מסוג אחד, במחיר אחיד  למדנו להתמודד עם טיפול במקרים שונים.
מבנה נתונים ואלגוריתמים ) לשעבר - עיבוד מידע( ד"ר אבי רוזנפלד ד"ר אריאלה ריכרדסון.
Computer Programs CS 1400 Dennis A. Fairclough Version 1.1 CS 1400 Dennis A. Fairclough Version 1.1.
Chapter 3: Introducing the Microsoft.NET Framework and Visual Basic.NET Visual Basic.NET Programming: From Problem Analysis to Program Design.
B065: PROGRAMMING Variables 2. Starter  What is wrong with the following piece of code: Option Explicit Off Dim num1 as string Dim num2 as integer num1.
Subroutines and Functions Chapter 6. Introduction So far, all of the code you have written has been inside a single procedure. –Fine for small programs,
אלגוריתמי חיפוש. Brute Force Module Module1 Function BruteForce(ByRef x() As Integer, ByRef item As Integer) As Integer Dim i As Integer For i = 0 To.
Week 2 - Wednesday CS 121.
A variable is a name for a value stored in memory.
מבוא למדעי המחשב לתעשייה וניהול
Data Types, Arithmetic Operations
מחלקות classes.
Chapter 2.
Comparing Numbers.
البرمجة بلغة فيجول بيسك ستوديو
Variables, Loops, Decision Statements, etc
ניתוח מערכות מידע תכנות ב C#
מבוא לתכנות בWINDOWS ב#C
Binary Lesson 2 Bytes.
Binary Lesson 2 Bytes.
VB.Net Programming Console Application
Binary Lesson 2 Bytes.
Counting
Counting
Place Value.
Lecture 1 Review of 1301/1321 CSE /26/2018.
BO65: PROGRAMMING WRITING TO TEXT FILES.
C# Revision Cards Data types
B065: PROGRAMMING Variables 2.
Reading from File & Picture Boxes
Comparing Numbers.
Сабақтың тақырыбы: Мәлімет типтері. Шамалардың сипатталуы
Section 6 Primitive Data Types
Presentation transcript:

סוגי מידע / משתנים ד " ר אבי רוזנפלד

סוגאורךטווח Boolean1 Bit0,1 Byte1 byte0-255 Char 2 bytes תו Decimal16 bytes0 through +/-79,228,162,514,264,337,593,543,950,335 Single4 bytes401298E-45 through E+38 Double8 bytes E-324 through E+308 Integer4 bytes-2,147,483,648 through 2,147,483,647 Long8 bytes-9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 Short2 bytes-32,768 through 32,767 StringVariable מילה

דוגמה פשוטה Module Module1 Sub Main() Dim x As Integer x = 10 Console.WriteLine((x + 2) / 10) Console.ReadKey() End Sub End Module

מה זה יעשה ? Module Module1 Sub Main() Dim x As Integer x = 10 Console.WriteLine(x + 2 * ) Console.ReadKey() End Sub End Module

מה יהיה הפלט ? Module Module1 Sub Main() Dim x, y, z As Integer x = 10 y = x / 3 z = x / 4 Console.WriteLine("x is " & x) Console.WriteLine("y is " & y) Console.WriteLine("z is " & z) Console.ReadKey() End Sub End Module

מבוא לתכנות למע " ס - מאיר קומר - סמסטר הצבה (השמה) - assignment Dim count as integer =1 num 5 num = 5 num = num + count 6 count Dim num as integer 1

מבוא לתכנות למע " ס - מאיר קומר - סמסטר אופרטורים -+*/-+*/ Mod \

מבוא לתכנות למנע " ס - שבוע מספר 2 - מאיר קומר - סמסטר ב ' - תשס " ו Const pi As single = יש גם קבועים

סוגים שונים של מידע (long) Module Module1 Sub Main() Dim x, y, z As Long x = 10 y = x / 3 z = x / 4 Console.WriteLine("x is " & x) Console.WriteLine("y is " & y) Console.WriteLine("z is " & z) Console.ReadKey() End Sub End Module

סוגים שונים של מידע (short) Module Module1 Sub Main() Dim x, y, z As Short x = 10 y = x / 3 z = x / 4 Console.WriteLine("x is " & x) Console.WriteLine("y is " & y) Console.WriteLine("z is " & z) Console.ReadKey() End Sub End Module

סוגים שונים של מידע (String) Module Module1 Sub Main() Dim x, y, z As String x = "Hello World" 'y = x / 3 This is in a comment 'z = x / 4 This is too Console.WriteLine("x is " & x) Console.WriteLine("y is " & y) Console.WriteLine("z is " & z) Console.ReadKey() End Sub End Module

מה זה יעשה ? Module Module1 Sub Main() Dim x, y, z As String x = "Hello World" y = x + " Aviland " z = x + " what???? " + y 'This actually works! Console.WriteLine("x is " & x) Console.WriteLine("y is " & y) Console.WriteLine("z is " & z) Console.ReadKey() End Sub End Module

העולם של קלט אתה חייב משתנה ( זיכרון לאחסן את המידע ) אתה גם חייב משתנה מתאים של Console.ReadLine

דוגמא Module Module1 Sub Main() Dim x, y As String x = "Hello World" Console.WriteLine(x) y = Console.ReadLine() 'It waits until "enter" Console.WriteLine("You typed " & y) Console.ReadKey() End Sub End Module

זה לא יעבוד Module Module1 Sub Main() Dim x As Integer x = Console.Read() ' this reads as a word! 'It waits until "enter" Console.WriteLine("You typed " & x + 1) Console.ReadKey() End Sub End Module

זה כן יעבוד Module Module1 Sub Main() Dim x As Integer x = Console.ReadLine() 'this works! 'It waits until "enter" Console.WriteLine("You typed " & x + 1) Console.ReadKey() End Sub End Module

מה זה יעשה ? Module Module1 Sub Main() Dim x As Integer Dim y As Decimal y = Console.ReadLine 'It waits until "enter" x = y Console.WriteLine("The whole portion was " & x) Console.WriteLine("The input was " & y) Console.WriteLine("The decimal was " & y - x) Console.ReadKey() End Sub End Module

Type Casting (and fun!) Module Module1 Sub Main() Dim thousands, hundreds, tens, ones As Integer Dim whole, stam_unused_variable As Decimal Console.WriteLine("Please enter a number greater than 1000 ") whole = Console.ReadLine 'It waits until "enter" thousands = Int(whole / 1000) whole -= thousands * 1000 hundreds = Int(whole / 100) whole -= hundreds * 100 tens = Int(whole / 10) ones = whole Mod 10 'Just for show off mod Console.WriteLine("The thousands part is " & thousands & ", the hundreds part is " & hundreds) Console.WriteLine("The tens portion is " & tens & " and the ones portion is " & ones) Console.ReadKey() End Sub End Module

פלט לקבצים Imports System.IO 'Notice the import! Module Module1 Sub Main() Dim writer As StreamWriter = _ New StreamWriter("z:\KBTest.txt") writer.WriteLine("File created using StreamWriter class2.") writer.Write("What???") writer.Close() End Sub End Module

דוגמא לקלט Imports System.IO 'Notice the import! Module Module1 Sub Main() Dim fileReader As StreamReader fileReader = _ My.Computer.FileSystem.OpenTextFileReader("KBTest.txt") Dim x As String x = fileReader.ReadLine() Console.WriteLine("The file line of the file is " & x) Console.ReadKey() End Sub End Module