CP1 Intro

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Computer Programming 1

Unit code: CIT 2218

Pre-requisites: CIT 2118 Fundamentals of Computers


Purpose
To enable the student learn basic computer programming
concepts.

Learning outcomes
At the end of the course, one should be able to:
1. Explain the techniques and principles of good programming
2. Illustrate algorithmic problem solving processes and basic
structure of a Program.
3. Write codes (programs) to solve engineering and related
problems using appropriate Programming language.

Course Outline
Introduction to Programming: Concept of
algorithms, Flow Charts, Data Flow diagrams etc.,
Introduction to the Editing tools such as vi or MS-VC
editors, Concepts of the finite storage, bits bytes, kilo,
mega and gigabytes. Concepts of character
representation, Number Systems & Binary Arithmetic.
Programming using C++: C++ data types, int, char,
float etc., C++ expressions, arithmetic operation,
relational and logic operations, C++ assignment
statements, extension of assignment of the
operations.
C++ primitive input output using getchar and
putchar, exposure to the scanf and printf
functions, C++ Statements, conditional executing
using if, else. Switch and break statements. Concept
1
of loops, example of loops in C++ using for, while and
do-while. Optionally continue may be mentioned.
One dimensional arrays and example of iterative
programs using arrays, 2-d arrays Use in matrix
computations. Concept of Sub-programming:
functions. Example of functions. Argument passing
mainly for the simple variables. Programming
examples.

Computer Programming

Introduction

Our concept is focused on a computer as a machine. The million dollar question is how
does this machine operate (work)? Then can you define a machine?
Machines can be categorized as simple or complex (compound). Their operation can be:
        1. Manual (human manipulation)
          2. Automatic analogue uses the control signal the way it is.
         3. Automatic digital converts the control signal in digital form.
The computer is a complex automatic digital machine. As you learnt its structure in the
unit code CIT 2128, name Fundamentals of Computers, it’s composed of hardware (H/W) and
software (S/W) modules. The two make up a machine called computer. The basic H/W is:
   1. CPU_ processing module
   2. Main memory (primary memory)
   3. I/O device interface (ports)
   4. Secondary storage (permanent storage/mass storage).
We are more interested in sotware component. We learnt in FoC that the computer s/w is
divided basically into two:
1. System s/w and
2. Application s/w.
The system s/w is further divided into two s/w:
1. BIOS Basic I/O System Test basic h/w sanity (okay?)
2. OS Operating System Manipulate h/w and applications
The two s/w operate the machine (h/w) and the application s/w to provide the user with the
expected results.

Note:
2 The user and h/w
are physical entities
the rest are logical
User

Application s/w

Operating System s/w

BIOS

H/W

Application S/W
The s/w provides what the owner of the computer wants, an application. A good case to compare
with is electrical power supply. The user (consumer) is interested in light, ironing clothes,
running a fridge, etc. These are applications, otherwise the details of how the electrical power is
generated, transmitted, and distributed is of least concern to the consumer (user). The same in
computing the user is interested in applications (tasks) such as word processor, spreadsheets,
database management, drawing, etc.
The s/w whether BIOS, OS or Application are all written as a program. What is a program? To
write a program a language (syntax) must be used. In programming, there are two basic
languages, viz:
1. Low level language
2. High level language

Low level language


- is further divided into:
i. Machine language written in o’s and 1,s; the binary, which very complex
ii. Assembler language written in mnemonics and unique to a particular microprocessor chip. It
is called instruction set. Examples microprocessors with unique instruction sets (Assembler
languages) are Intel, Zilog, Motorola, etc.
They are called low level because they are more close to the h/w than to the user.

High level language


These are close to the user language. Examples of instructions (commands) are such as copy, cut,
print, read, etc., for the English speaking users.
The user (owner) of the computer is the most important in the scenario, hence at a high level.
Examples of high level (programming) languages are such as:
i. C
ii. C++
iii. Java
iv. Python
v. Matlab,
etc.

In this course we will train on C++ programming language, which is very close to C and Java
languages.

3
C++ Programming Language

Introduction
Discussion on Program:
 Structure
 syntax

You might also like