انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

# Computer Programming I_6

الكلية كلية الهندسة     القسم  الهندسة البيئية     المرحلة 1
أستاذ المادة رواء حسين كاظم العيساوي       07/07/2018 18:45:37
Matrices
One dimensional matrices
These types of matrices consist of elements arranged in one column or one array each element has a constant position (location) in the matrix and this position remain constant until we change it.
• The matrix compound of name of matrix which recognized each matrix from the other and variables demonstrate the location (position) of each element :
A (5) : matrix with name A and with 5 position .
• The matrix has a retain statement with general form : No. of statement DIM name of matrix (constant) DIM A (5)
• The matrix must read before apply any application on its elements.
Example -1: Write a program in Qbasic language to read one dimensional matrix consists of 5 elements and print the first and last element of it.
[6 11 27 22 24].

Solution:
REM THIS PROGRAM TO PRINT FIRST AND LAST NUMBER
DIM A(5)
FOR I = 1 TO 5