0% found this document useful (0 votes)
43 views11 pages

Arrays and Files in Programming

This document describes the arrays and files in topic 5 of a course on algorithms and programming languages. It explains one-dimensional, two-dimensional, and multifunctional arrays, as well as opening, input-output of data, and closing of files. Finally, it details the stages of program development such as needs analysis, design, development, implementation, and maintenance.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views11 pages

Arrays and Files in Programming

This document describes the arrays and files in topic 5 of a course on algorithms and programming languages. It explains one-dimensional, two-dimensional, and multifunctional arrays, as well as opening, input-output of data, and closing of files. Finally, it details the stages of program development such as needs analysis, design, development, implementation, and maintenance.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Subject:

Algorithms and programming languages.

Unit 5 Theme:

ARRANGEMENTS AND FILES.

Professor:

Ing. Guillermo Barragán Jiménez

I elaborate:

Luz Fernanda Martinez Cruz

date:

January 17, 2019

[Link].
Syllabus:

5 ARRAYS AND FILES.

5.1 ONE-DIMENSIONAL ARRAY.

5.2 BIDIMENTIONAL AND MULTIFUNCTIONAL ARRANGEMENT.

5.3 OPENING, DATA ENTRY-EXIT AND CLOSURE OF


FILES.

5.4 PROGRAM DEVELOPMENT.


5.1 Unidimensional:

A one-dimensional array is a type of structured data that is


composed of a finite and ordered collection of data of the same type.

It is the natural structure for modeling lists of identical elements. The


data stored in arrays must all be of the same type.
The type of access to one-dimensional arrays is direct access,
that is, we can access any element of the array without having
to consult previous or subsequent elements, this through the
use of an index for each element of the array that gives us its
relative position.

To implement one-dimensional arrays, space must be reserved.


in memory.

Arrays allow us to perform a set of operations to


manipulate the data stored in them, these operations are:
sort, search, insert, delete, modify among others.

5.2 Two-dimensional and Multidimensional Array:


In programming, a multidimensional array is an array that is
index by an ordered list of integers. The number of integers
what is used in this list to index the multidimensional vector is
always the same and is known as the dimensionality of the vector.
On the other hand, the limits of each of the integers that form
part of the index determines the dimension of the vector.

A vector with dimensionality k is commonly referred to as k-dimensional.


One-dimensional vectors correspond to vectors
ordinary ones in which the elements are arranged in a single row
(or column); 2-dimensional vectors are another way of referring to
the classic matrices in which their elements are arranged in
various rows and columns (two dimensions). In practice, the
The dimensionality of a vector rarely exceeds three.
The initialization of two-dimensional arrays is done in the
next way:

float sales [4] [3] = { { 14.5,


26.7,65.1
3.14, 15.1, 16.5
6.3
31.74 } };
{ 5.2, 1 .9, 21.6 },
Note that the values of each row are placed within the braces
separated by commas, each line separated by a comma except the
last and all the lines between curly braces. The initialization can be
write in a single line, but it is written as shown so that
is displayed in a matrix form.

5.3. CHARACTER ARRAYS.


Example of statement:
char array String[] = "good";
Let us note that we have not specified any index, the compiler will count the
the number of letters in the string 'buenas' (there are 6) and will add one for
include the null character ('\0'). The null character indicates the termination of the
Chain, it is always important to keep this in mind.

Example of a declaration:
char arregloCadena2[7] = {'b','u','e','n','a','s','\0'}; In this statement
We initialize each of the elements of the array individually.
Note that we explicitly initialized the character in element 7 of the array.
null '\0'.

Example of declaration:
char arre gl oCadena3
other chain
The array string 3 will reserve 12 places in memory, since in addition to the 10
what the words add up to, there is a space and the null character.

Arrays and 'cin >>'


We can use cin >>arrayString to assign to an array (from the
keyboard or standard input), but we must keep in mind that cin >> will read and
will assign until it detects the first whitespace character (space).

Example of 'cin >>'


char stringArray4[25]; cin >> stringArray4; Yes here the user
If you enter 'it's hot' via keyboard, the arrayCadena4 would only store
the string "makes" and "heat" would be completely ignored. It could also happen
that the user enters more than 24 characters (the last one is null) what
it would cause a 'Segmentation fault' when trying to assign values out of bounds
from the array, so the programmer should be careful when using cin >> with
arrangements.

5.4 Development of Programs.


Programs are the building blocks of systems.
information. When software products are made, programmers
they follow a process that resembles the life cycle of systems
complete information. The software development life cycle (SDLC).
Now we will discuss the software development life cycle which is
similar.
Analysis of needs.
This analysis is the stage where a need is identified and understood.
problem. In the first stage, the programmer reviews the program design
to see what the user needs to create an interface and the starting point,
and also what the user needs the program to do. Normally, the
The end user must have a lot of information for the analysis layer of the
needs.
Once what the
the programmer has finished the
initial point and the final point of the program, you can start designing the code.

Program design.
The program design is the phase where the programmer begins to approach.
to the logic they will use when starting the creation of real code. They can
use many tools in the process of designing a program, although to
often programmers use whiteboards and napkins.

Three of these design tools are IPO diagrams (for the


structured programming) lines with circles and messages (programming
object-oriented) and pseudocodes.

Development.
Development or coding relates to writing and testing code
source. The software development source is similar to the development phase.
of the life cycle of systems, but instead of determining the overall design
of the system, the programmer writes the code that implements the
user requirements. The programmer can write the source code in
a text editor and then compile the code. Or you can use a visual editor and
create an image of the application before compiling the code. Most of
the work required to complete a program is used in this stage
using the programming languages you have learned
previously. Despite their best efforts, the programmers
They inevitably create errors in their programs. There are two main types.
of errors: syntax errors and logical errors. Syntax errors violate
the rules of the programming language. Finding syntax errors is
relevantly simple because the compiler or interpreter will point them out
for the programmer. Logical errors, errors that occur in the algorithm, are more
difficult to find and probably won't appear until weeks or
months after it has been implemented. The process of identifying and
eliminate these errors known as debugging.

The implementation.
The implementation relates to the installation of the software and to allowing
that users try it. This step usually includes a large amount
of documentation, both within the code and in the form of manuals for
users. Many programmers will also tell you that they perform the most
part of the debugging in this layer. It is really in the layer of
implementation when any design error has occurred
programmer in the code that is found and repairs.
Maintenance.
Maintenance begins as soon as the program has been installed.
work on the products continues for various reasons. It is likely that
some minor errors have not been fixed at the time when the
the program was finished. It is also likely that the programmers want
add important new features in response to the demands of the
market or user requests. This is the longest stage of the cycle.
program development life, and sometimes it can last several years.

CONCLUSION:
In traditional programming, there are always two types.
of arrangements the arrangements type lists, vectors or
one-dimensional and table-type arrays, squares,
concentrates, matrices or two-dimensional in both cases
They are variables that allow you to store a set of data.
of the same type at once, their difference is in the quantity of
columns that each of these types contains.
To conclude in a few words, an arrangement is the best
solution when grouping different data that is from a
same type, this data is stored in memory and
they receive a common name for all.
BIBLIOGRAPHY:
[Link]
investigation-arrangements/
Unable to access the provided link.
[Link]
Invalid input. Please provide text for translation.
Questionnaire:
1.- What is an array?
Arrays are a collection of variables of the same type that
they reference using a common name.
2.- What does an array consist of?

An array consists of contiguous memory positions. The address is the most


the lowest corresponds to the first element and the highest to the last.

3.- How many dimensions can an array have?


An array can have one or several dimensions.
4.- How can you access a particular element in an array?
To access a particular element in an array, an index is used.
5.- mention some problems that require handling large amounts
number sequences?
the weather prediction, the construction of buildings, and the analysis of
financial indicators among many others.
6.- data structure used to store large sequences of
numbers?
The data structure that is used to store these large
sequences of numbers (generally of type float) is the array.
7.- What are the similarities shared by arrays and lists?
the
elements have an order and
They can be accessed by their position, the elements can be
traverse using a for loop.
8.- What are your restrictions?
all elements of the array must have the same type, in general,
the size of the array is fixed (they do not grow dynamically like the
lists), are mainly used to store numerical data.

9.- module that provides data structures and functions for


working with arrays?
The module that provides the data structures and the functions for
Working with arrays is called NumPy
10.- What are two-dimensional arrays?
Two-dimensional arrays are tables of values.
11.- is simultaneously in a row and in a column.
Each element of a two-dimensional array
12.- What are two-dimensional arrays called in mathematics?
In mathematics, two-dimensional arrays are calledmatrices, and
they are widely used in Engineering problems.
13.- In a two-dimensional array, each element has a position that
it is identified by two indices.
the one from its row and the one from its column.

14.- What is a program?


they are the building blocks of information systems.
15.- it is the stage where a need is identified and understood or
problem.
The analysis of needs
16.- In what
stage the programmer reviews the design
of the program to see what the user needs to create an interface
and the starting point?
In the first stage
17.- It is the phase where the programmer begins to approach the logic
What they will use when the real code creation begins.
The design of the program

18.- What is used for development or coding?


Development or coding relates to writing and testing of
source code.

19.- is related to the installation of the software and allowing it to


users try it.
The implementation
20.- When does the maintenance of a program begin?
Maintenance begins as soon as the program has been
installed

You might also like