السلام عليكم في هذا الفيديو القصير سأقوم بشرح الـ Multidimensional Array ويتوقع منك في نهاية هذا الفيديو أن تكون قادرا على: توضيح الـ Multidimensional Array، تطبيقها لحل مشاكلٍ عملية. لننتقل سوياً إلى طرح مشكلة عملية وبيان كيفية حلها باستخدام الـ Multidimensional Array. في المحاضرة الماضية حكينا عن الـ One dimensional Array الـ One dimensional Array بيكون فيه عندنا sequence of elements والـ array [غير مفهوم] وفي محاضرة اليوم راح نحكي عن الـ multidimensional array. في البداية إذا نحكي عن الـ two dimensional array هي عبارة عن table فيها rows و columns الـ data type بتاع الـ two dimensional array الـ data type بتاع الـ elements of the array، for example integer coma، في number of dimension- 1، هنا فيه عندنا two dimension array هاي الـ first dimension هاي الـ second dimension وراح يتعمل differentional للـ two dimentional array [سعال] is my table equals new integer on the third dimension فيه 3 elements second dimension فيه 4 elements يعني راح نحكي عن 3×4 elements or 3×4 array، بنعمل زي هيك بيتم إنشاء two dinension array على شكل table ﻷنها two D، بيكون فيها مجموع الـ dimension 3 rows, 3 elements, index by zero, one two, الـ second dimension بيكون فيه 4 columns, zero, one, two, three, الـ number of rows أو الـ number of elements في الـ link بتاع الـ first dimension بنجيبه من table .get link using matrix of get link of zero, يعني الـ link لـ third dimension equals 3 table dot get link of one اللي هو الـ link بتاع second dimension اللي هما في الحالة بتاعتنا 4، لو حكينا table dot link حترجع لنا the number of elements 3x4 اللي هي 12، هنا بدنا نعمل direct access للـ element اللي فيه multidimensional array بنحكي for example table of zero, zero هاي element, table of one, one هاي element table of one two هاي element، طبعاً ممكن يكون فيه higher dimension زي three dimensional array، بيكون فيه هنا get link of zero, get link of one, get link of two هنا بيكون اسم الـ element, table of one, one, one and so on, and so on، خلينا نكتب كـ code, two create a two dimension array populate it, access it[صوت] خلينا نعمل matrix أو two dimension array of integer هنا two dimension array تساوي one, comma. one third dimension, second dimension اسمها matrix, equal new integer 3×4، هنا إذا بعمل الـ matrix matrix dot link equal matrix dot link بنحكي get link، get link of zero اللي هو الـ first dimension هنا بيعطينا get link of zero get link of one حطينا 4، get link of one يعطينا 4 نعمل run الـ link 12، first dimension هنا 3 link second dimension 4, هنا, if we try to access dimension number two حيعطينا exception لأنه هذا two dimension array مش three dimension array عطانا index was outside of the array [غير مفهوم] نطبع matrix of zero, zero حيعطينا zero ﻷنه initially الـ matrix أو الـ array of integer بيكون الـ elements كلهم فيهم zero راح نقدر [أجنبي] نغير القيمة ونكتب، for example marix of two, one equal five إذا بنطبع two, one راح يعطينا five. To iterate over the elements of the array we can use nested for loop for integer i row equal zero, zero, row index then اللي هو matrix dot get link of zero [غير مفهوم] حنسوي نفس الشيء for [أجنبي] يعني [أجنبي] matrix dot get link of one c++ [غير مفهوم] marix of row and column, راح يتخزن فيها القيمة [غير مفهوم] for as in the example أو بنقدر نطبع هاي القيمة نطبع هاي القيمة. نطبعهم [غير مفهوم] C بنخزن قيمة ونطبعها [أجنبي]، ونعمل run ونخزن فيها zero, one, two, three اللي هما row number or row index plus column index zero + zero zero zero plus one equals one and here three plus two, five. zero, one, two, two three equals five. Okay [غير مفهوم] we can use for each statement we iterate over the elements of the matrix to iterate over elements inside the matrix لكن في هالحالة [غير مفهوم] zero, one, two, three. اللي هما الـ elements الموجودة في first row وبعدين بنروح على الـ elements الموجودة في الـ second row one, two, three, four, one two, three for وبعدين one, two, three, four, five, also, we can use the two dimensional array or the mutidimensional array في الـ [غير مفهوم] for example public static method we can ممكن هال method تعمل returnلـ two dimensional array or three dimensional array or higher dimensional array, for example this one [غير مفهوم] [غير مفهوم] two dimensional array, return equals new integer بيكون نفس length, we have to check get link of zero and be dot net of one, before that we have to make sure A and B have the same size, same size of table, get link of zero and get link of one [أجنبي] zero, equals b dot get link of zero same thing for the second dimension so, if it is not correct then we need to return for example null or we need to raise an exception then we have to check that both A and B are not null [غير مفهوم] [غير مفهوم] over the element we can use nested for loop same quite here we can [أجنبي] matrix, this[أجنبي] is our matrix [INAUDIBLE] A this one is [غير مفهوم] for example now, we are itrating over the element الموجودة في A R matrix of RC equals نحكي A of [غير مفهوم] plus B of R and C. [غير مفهوم] we are adding matrix A + C and B بنحطها في new matrix اسمها R matrix ونرجعهم حكينا we need to check that both A and B are not null and that's it، الله يعطيكم العافية [موسيقى]