تعريف المصفوفات Arrays Dim OneDim (9) As Integer ' 10 عناصر Dim TwoDims (1, 1) As String ' عناصر 4= 2 * 2 OneDim (0) = 100 OneDim (1) = 200 … OneDim (9)

Slides:



Advertisements
Similar presentations
Arrays in Flash What is an Array: What is an Array: Array is a list of cells, each cell in the list has a number to identify it (index or position). هي
Advertisements

2.3 Modeling Real World Data with Matrices
Execute Blocks of Code Multiple Times Svetlin Nakov Telerik Corporation
Execute Blocks of Code Multiple Times Telerik Software Academy C# Fundamentals – Part 1.
Programming Patterns CSC 161: The Art of Programming Prof. Henry Kautz 9/30/2009.
1 CS 162 Introduction to Computer Science Chapter 7 Matrix Manipulation Herbert G. Mayer, PSU Status 9/21/2014.
Modeling using VBA. Covered materials -Userforms -Controls -Module -Procedures & Functions -Variables -Scope.
Maths for Computer Graphics
11-1 Chapter 11 2D Arrays Asserting Java Rick Mercer.
جداء و خارج عددين جذريين
Introduction to Computing Dr. Nadeem A Khan. Lecture 28.
1 Chapter 7 Arrays. 2 Outline and Objective In this chapter we will Learn about arrays One-dimensional arrays Two-dimensional arrays Learn about searching.
Lesson 3: Writing Products as Sums and Sums as Products
Arrays. What is the output of: Private Sub cmdButton_Click() Dim i As Integer, a(1 To 4) As integer Open "DATA.TXT" For Input As #1 For i = 1 To 4 Input.
CHAPTER 8 ARRAYS FORTRAN 90 provides arrays for storing, structuring and processing a collection of data values that are related in some way such as a.
1 Chapter 7 Arrays. 2 Outline and Objective In this chapter we will –Learn about arrays One-dimensional arrays Two-dimensional arrays –Learn about searching.
الحلقات for For i =1 To x step -2 …………. Next DO while (شرط) …………. Loop DO …………. Loop while (شرط) الحلقة Do while.
1.7 Arrays academy.zariba.com 1. Lecture Content 1.Basic Operations with Arrays 2.Console Input & Output of Arrays 3.Iterating Over Arrays 4.List 5.Cloning.
Jeopardy Algebraic Expressions Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Real Numbers Matrix Usage Math Properties Right Triangles.
IE 212: Computational Methods for Industrial Engineering
Microsoft Visual Basic 2008 CHAPTER NINE Using Arrays and File Handling.
Microsoft Visual Basic 2005 CHAPTER 9 Using Arrays and File Handling.
Using Arrays and File Handling
Class 3 Programming in Visual Basic. Class Objectives Learn about input/output Learn about strings Learn about subroutines Learn about arrays Learn about.
Section 7.2 & 7.3.  Row x Column ROW COLUMN a x + b y = c d x + e y = f AB X.
 Data is always stored in a logical way so that it can be accessed efficiently. Ex:A telephone directory  The way data is stored is called the structure.
1 Lecture 5: Part 1 Searching Arrays Searching Arrays: Linear Search and Binary Search Search array for a key value Linear search  Compare each.
Arrays and 2D Arrays.  A Variable Array stores a set of variables that each have the same name and are all of the same type.  Member/Element – variable.
19/10/20151 Data Structures Arrays. 219/10/2015 Learning Objectives Explain initialising arrays and reading data into arrays. Design and write routine/s.
VB Core II Conditional statements Exception handling Loops Arrays Debugging.
Chapter 8: Collections: Arrays. 2 Objectives One-Dimensional Arrays Array Initialization The Arrays Class: Searching and Sorting Arrays as Arguments The.
# 1# 1 Searching andSorting What is selection sort? What is bubble sort? What is binary search? CS 105 Spring 2010.
Lecture (2) Vectors, Matrices Eng. Osama Talaat 1.
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
Variables,Constants and Data types Variables temporarily stores values during the execution of an application Variables have a name and data type Declare.
‘Tirgul’ # 3 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #3.
If A and B are both m × n matrices then the sum of A and B, denoted A + B, is a matrix obtained by adding corresponding elements of A and B. add these.
Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays.
Copyright © 2001 by Wiley. All rights reserved. Chapter 6: Using Arrays Control Arrays List Arrays Finding Items in Arrays Multiple Forms 2-Dimensional.
6-1 Chapter 6 Working with Arrays in VB.NET. 6-2 Learning Objectives Understand the use of list and table arrays in VB.NET projects and the difference.
مسألة أكتب برنامجاً يقوم بقراءة عددين و إظهار رسالة تفيد بأن أحد العددين هو المضاعف النوني للعدد الآخر و في حال عدم كون أي من العددين مضاعفاً للآخر يظهر.
The length of a rectangle is 6 in. more than its width. The perimeter of the rectangle is 24 in. What is the length of the rectangle? What we know: Length.
Arrays. The array data structure Array is a collection of elements, that have the same data type Integers (int) Floating point numbers (float, double)
Visual Basic Objects / Properties / Methods PropertyAdjective ObjectNoun Part of the application Attribute MethodVerb Action to do something.
1 Microsoft® Visual Basic®.NET Language # 2. 2 Flow-Control Statements If … End If Select Case … End Select For… Next Do … Loop Exit.
Example 7 Multiplying with Technology Chapter 7.3 Use technology to compute BA and AB if and.  2009 PBLPathways.
1.8 Multidimensional Arrays academy.zariba.com 1.
Data Structures: Multi-Dimensional Arrays Damian Gordon.
MULTI-DIMENSIONAL ARRAYS 1. Multi-dimensional Arrays The types of arrays discussed so far are all linear arrays. That is, they all dealt with a single.
Array of pointers We can have an array whose members are pointers, in this example pointers-to-int. int* data[3]; int i; int x = 5; int y = 89; int z =
نعلم أن : معادلة الدرجة الاولى في متغيرين تمثل مستقيماً في المستوي الإحداثي ، ولرسمه يتعين تحديد نقطتين منه في المستوي لذلك : عند ايجاد الحل المشترك لمعادلتين.
情報基礎 A Lecture 12 Takeshi Tokuyama Tohoku University Graduate School of Information Sciences System Information Sciences Design and Analysis of Information.
فصل 1 (المصفوفات)Matrices
VBA - Excel VBA is Visual Basic for Applications
Using the Console.
VB.Net Programming Console Application
Matrix Equations Step 1: Write the system as a matrix equation. A three-equation system is shown below. First matrix are the coefficients of all the.
Register Use Policy Conventions
CSCI 3327 Visual Basic Chapter 7: Data Manipulation in Arrays
للمزيد زورونا على موقعنا الإلكتروني:
10 0× 1 = 4× 4 = (وحدات)4 10 1× = 5 50 = (عشرات)5
Multiplying Matrices.
Programming -2 برمجة -2 المحاضرة-1 Lecture-1.
استعمال الدوال الجاهزة
Suppose I want to add all the even integers from 1 to 100 (inclusive)
Multiplying Matrices.
VB.Net Programming Console Application
Multiplying Matrices.
Multiplying Matrices.
Multiplying Matrices.
Presentation transcript:

تعريف المصفوفات Arrays Dim OneDim (9) As Integer ' 10 عناصر Dim TwoDims (1, 1) As String ' عناصر 4= 2 * 2 OneDim (0) = 100 OneDim (1) = 200 … OneDim (9) = 900 TwoDims (0, 0) = “Ahmad” TwoDims (0, 1) = “khaled” TwoDims (1, 0) = “Mouhamed” TwoDims (1, 1) = “Hassan”

Imports system.console Module Module1 sub Main() Dim OneDim() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9} Dim TwoDims(,) As String = {{“Saad",”George"},{”Lolo",”ٌReem"}} Dim test(,) as Integer = {{1,2,3},{4,5,6}} Writeline(test(0,0)) Writeline(test(0,1)) Writeline(test(0,2)) Writeline(test(1,0)) Writeline(test(1,1)) Writeline(test(1,2)) Readline() End sub

Imports System.Console Module Module1 Sub Main() Dim liste() As String = {"Rami", "Sami", "Keis", "Lina", "Linda"} Dim points() As Integer = {70, 65, 66, 50, 55} WriteLine(liste.Length) WriteLine(liste.Rank) WriteLine(liste(0)) WriteLine(liste(2) & " : " & points(2)) ReadLine() End Sub End Module

مسألة أكتب برنامجاً يقوم بقراءة ثلاثة أعداد {a1, a2, a3} و يحسب قيمة كل من المتوسط الحسابي و المدى لتلك الأعداد و يظهرهما على الشاشة مسائل في البرمجة

Sub Main() Dim a(2), m, rng As Single Dim minv, maxv As Single Console.WriteLine("Enter the first number") a(0) = Console.ReadLine Console.WriteLine("Enter the second number") a(1) = Console.ReadLine Console.WriteLine("Enter the third number") a(2) = Console.ReadLine m = (a(0) + a(1) + a(2)) / 3 مسائل في البرمجة

If a(0) > a(1) And a(0) > a(2) Then maxv = a(0) ElseIf a(1) > a(0) And a(1) > a(2) Then maxv = a(1) Else maxv = a(2) End If If a(0) < a(1) And a(0) < a(2) Then minv = a(0) ElseIf a(1) < a(0) And a(1) < a(2) Then minv = a(1) Else minv = a(2) End If مسائل في البرمجة

rng = maxv - minv Console.WriteLine("The Avarage is: " & m) Console.WriteLine("The range is: " & rng) Console.WriteLine("Press any key to exit") Console.ReadLine() End Sub مسائل في البرمجة

If a(1) > a(2) Then If a(3) > a(1) Then minv = a(2) : maxv = a(3) ElseIf a(3) < a(2) Then minv = a(3) : maxv = a(1) Else minv = a(2) : maxv = a(1) End If Else If a(3) > a(2) Then minv = a(1) : maxv = a(3) ElseIf a(3) < a(1) Then minv = a(3) : maxv = a(2) Else minv = a(1) : maxv = a(2) End If مسائل في البرمجة

مسألة أكتب برنامجاً يقوم بقراءة مجموعة من الأعداد {a1, … an} عددها n و يحسب قيمة كل من المتوسط الحسابي و المدى لتلك الأعداد و يظهرهما على الشاشة مسائل في البرمجة

Sub Main() Dim n As Int16 Dim a(), sum, m, rng As Single Console.WriteLine("Enter the number of the elements") n = Console.ReadLine ReDim a(n) Console.WriteLine("Enter the first number") a(0) = Console.ReadLine Dim minv As Single = a(0) Dim maxv As Single = a(0) sum = a(0) For i As Int16 = 1 To n-1 Console.WriteLine("Enter the next number") a(i) = Console.ReadLine sum += a(i) If a(i) < minv Then minv = a(i) If a(i) > maxv Then maxv = a(i) Next m = sum / n rng = maxv - minv Console.WriteLine("The Avarage is: " & m) Console.WriteLine("The range is: " & rng) Console.WriteLine("Press any key to exit") Console.ReadLine() End Sub مسائل في البرمجة

مسألة أكتب برنامجاً يقوم بحساب البعد بين نقطتين و من ثم حساب ميل المستقيم المحدد بهما مسائل في البرمجة

Imports System.Math Module Module1 Sub Main() strt: Dim st As String Dim x1, x2, y1, y2, dis, slope As Single Console.WriteLine("Enter x1") x1 = Console.ReadLine Console.WriteLine("Enter y1") y1 = Console.ReadLine Console.WriteLine("Enter x2") x2 = Console.ReadLine Console.WriteLine("Enter y2") y2 = Console.ReadLine dis = Sqrt((x1 - x2) ^ 2 + (y1 - y2) ^ 2) مسائل في البرمجة

If dis > 0 Then If x1 <> x2 Then slope = (y1 - y2) / (x1 - x2) Console.WriteLine("Slpoe= " & slope) Else Console.WriteLine("Undefined slope") End If Else Console.WriteLine("You entered two congruant points") End If Console.WriteLine("Press x to exit or r to repeat the program with new points") st = Console.ReadLine If st = "r" Then GoTo strt ElseIf st = "x" Then Exit Sub End If End Sub End Module مسائل في البرمجة

مسألة لدينا مصفوفة من الدرجة الثانية تحوي عدد من العناصر و قيمة ما نريد إخراج مصفوفة مماثلة في الأبعاد للمصفوفة الأصلية و تحوي واحدات في المواقع المقابلة لوجود القيمة المعطاة و أصفار في بقية المواقع مسائل في البرمجة

Sub Main() Dim v As Single Dim b(,), e(,) As Single Dim n, m As Int16 Console.WriteLine("Enter the number of rows") m = Console.ReadLine Console.WriteLine("Enter the number of columns") n = Console.ReadLine ReDim b(m, n) : ReDim e(m, n) مسائل في البرمجة

'reading the data For i As Int16 = 1 To m For j As Int16 = 1 To n Console.WriteLine("Enter the element b(" & i & "," & j & ")") b(i, j) = Console.ReadLine Next Console.WriteLine("Enter the value you want to search for") v = Console.ReadLine مسائل في البرمجة

'searching for the value For i As Int16 = 1 To m For j As Int16 = 1 To n If b(i, j) = v Then e(i, j) = 1 Else e(i, j) = 0 End If Next مسائل في البرمجة

'printing the matrix e For i As Int16 = 1 To m For j As Int16 = 1 To n Console.WriteLine("e(" & i & "," & j & ")= " & e(i, j)) Next Console.WriteLine() مسائل في البرمجة

'another way to print the matrix e Dim ee As String Dim k, l As Int16 Console.WriteLine("e=") Console.WriteLine() For k = 1 To m ee = "" For l = 1 To n ee &= e(k, l) & " " Next Console.WriteLine(ee) Next Console.ReadLine() End Sub مسائل في البرمجة

مسألة لدينا مجموعة نقط في المستوي n نقطة و مستقيم و المطلوب إيجاد بعد كل نقطة عن ذلك المستقيم مسائل في البرمجة

Imports System.Console Imports System.Math Module Module1 Sub Main() str: Dim st As String Dim a, b, c As Single Dim p(,), d() As Single Dim n As Int16 WriteLine("Enter the number of points") n = ReadLine() ReDim p(n, 2) : ReDim d(n) مسائل في البرمجة

WriteLine("Enter the constant a") a = ReadLine() WriteLine("Enter the constant b") b = ReadLine() WriteLine("Enter the constant c") c = ReadLine() If a = 0 And b = 0 Then WriteLine("No line with a=0 and b=0") ReadLine() Exit Sub End If مسائل في البرمجة

For i As Int16 = 1 To n WriteLine("Enter x(" & i & ")") p(i, 1) = ReadLine() WriteLine("Enter y(" & i & ")") p(i, 2) = ReadLine() Next For i As Int16 = 1 To n d(i) = Abs(a * p(i, 1) + b * p(i, 2) + c) / Sqrt(a ^ 2 + b ^ 2) WriteLine("P(" & p(i, 1) & "," & p(i, 2) & ") -- distance= " & d(i)) Next WriteLine("Press 'r' to repeat") st = ReadLine() If st = "r" Then GoTo str End Sub End Module مسائل في البرمجة