Procedural Programming Assignment

1009 Words5 Pages
ITPP111- Procedural Programming Assignment.
Name: Bradley barker:
Student Number: RJMMLYX21
Question 1
1.1. Computers store data of all sorts in a binary number format. In the binary system all numbers are made up of 1’s and 0,s. Data type can be text or numbers. Other data types such as sound and pictures are not discussed here.
The computer divides data into small pieces called bits. Eight bits make up a single Byte. Each of the bits is either a 1 or a 0. For example 11010101 would be an 8 bit binary number stored in one byte. This number would represent the number 213 in the decimal system.
Characters, including letters of the alphabet and punctuation marks, are first converted into a numeric code and then like numbers they are
…show more content…
The following describes the conversion form digital to binary and vice-versa. (Mark Prather, n.d.)
1.2. The fetch-decode-execute cycle of a computers CPU can be explained as follows:
Machine language is the lowest level language (binary). Computers can only execute machine code, so the CPU needs to fetch machine code from memory, decode the code into the correct software instructions and then execute the instruction. This is called the fetch-decode-execute cycle.
In order to put instructions and data into memory, high level languages such as C++, Java etc. are used to write programs and instructions. The instructions are converted in binary machine code and stored in the computer’s memory and or storage devices. To execute the program and instructions the reverse process is followed.
The following steps are taken from the teacher.info.Ltd. (theteacher.info Ltd, 2016).
• “To 'run ' a program, the CPU has to get the first instruction in the program.
• It puts the address of the instruction it wants to fetch on the address
…show more content…
Typically tables of data under various headings can be considered an array. An array can also be a simple list of items.
Arrays are made up of elements in specific cells or locations in the array. Each cell has a specific location or address, also known as a numerical Index
The elements of the array can be values or variables. They can be text or numbers.
A day to day example could be a list of salesmen and their daily sales.
“An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier. (cplusplus.com, 2000)”. (Craigmount Higher Computing, 2007)
b) In C++, an array element is accessed by writing the name of the array followed by the subscript in square brackets (this is also called the Index number). Array elements are number from 0 to (n-1) the number of element in the array. So if an array has 256 elements. The last one will be number 255.

c) There are a number of ways arrays can be manipulated.

a. You can perform mathematical operations on the elements.
b. You can sort the elements from largest to smallest.
c. You can search for data meeting certain criteria within the
Open Document