0% found this document useful (0 votes)
20 views

Chapter 1 - Introduction to C++

Computer program c++

Uploaded by

Shafi Esa
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)
20 views

Chapter 1 - Introduction to C++

Computer program c++

Uploaded by

Shafi Esa
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
You are on page 1/ 23

Exit Exam Tutorial

Part 1: Computer Programming


Episode 1: Introduction to Computer Programming
1.1 Introduction to Computer
Programming
1.1.1 What is Computer?

- A computer is an electronic device, operating under the


control of instructions stored in its own memory that can
accept data (input), process the data according to specified
rules, produce information (output), and store the
information for future use.
- Any kind of computers consists of hardware and software.
- A computer stores any data in the form of 0’s and 1’s.
1.1 Introduction to Computer
Programming

It works with the program (binary) between 0s and 1s, because the
computer can understand the machine language.
1.1 Introduction to Computer
Programming
1.1.2 What is Programming?

- Programming is a skill that can be acquired by a computer


professional that gives him/her the knowledge of making
the computer perform the required operation or task.
- Programming skill is a skill that can be acquired by a
computer professional that gives him/her the knowledge of
making the computer perform the required operation or
task.
- There must be a set of instructions called a program that
directs the computer to perform some specific tasks, which
is developed by professionals.
1.1 Introduction to Computer
Programming

Programmer is a person who creates programs that solve a problem using the computer
1.1 Introduction to Computer
Programming

A program is a sequence of steps that a computer understands and executes


1.1 Introduction to Computer
Programming

A programming language is an environment/notation used to write instructions into


a computer
1.1 Introduction to Computer
Programming
- A bug is an error in a program.
- Debugging is the process of removing errors, testing and
revising a program to make sure that it performs as
expected.
- Syntax is rules, in every programming language there are
sets of rules that govern how the instruction is written in a
programming language.
- Semantic rules, which describe the meaning, associated
with the syntax, symbol etc.
- In order to solve/perform a given problem, computers must
be given the correct instruction about how they can solve it.
1.1 Introduction to Computer
Programming
1.1.3 Problem Solving Technique
- A problem is an undesirable situation that prevents the
organization from fully archiving its purpose, goals,
objectives or problem can also be defined as the gap
between the existing and the desired situation where
problem solving will try to fill this gap.
- Problem solving is the process of transforming the
description of a problem into the solution.
- By using our knowledge of the problem domain and by
relying on our ability to select and use appropriate
problem-solving strategies, techniques and tools.
1.1 Introduction to Computer
Programming
1.1.4 Algorithm
- An algorithm is defined as a step-by-step sequence of
instructions that must terminate and describe how the data
is to be processed to produce the desired outputs.
- A finite set of steps that specify a sequence of operations to
be carried out in order to solve a specific problem.
- An algorithm is a sequence of unambiguous instructions for
solving a problem.
1.1 Introduction to Computer
Programming
1.1.4.1 Characteristics of Algorithm
- A good algorithm should have the following characteristics:
• Input: There should be at least one input.
• Output: There should be at least one output.
• Well-ordered: The steps are in a clear order.
• Unambiguous: The operations described are understood by
a computing agent without further simplification.
• Effectively computable: The computing agent can actually
carry out the operation.
• Finiteness/Termination: An algorithm must terminate after
finite number of steps.
• Correctness: Everything in the algorithm should be correct.
1.1 Introduction to Computer
Programming
1.1.4.2 Tools used to develop algorithm
- There are two commonly used tools to develop algorithm.
A) FLOWCHARTS: is a graphical representation of an
algorithm or a process flowchart is used for representing
algorithm in pictorial form, flowcharts work well for small
problems.
B) PSEUDO-CODE: is useful for describing algorithms in a
structured way. It makes use of simple English-like
statements, pseudo-code is used for larger problems.
1.1 Introduction to Computer
Programming
1.1.5 Program
- A program is a set of instructions that is written in the language
of the computer.
- A program is used to make a computer perform a specific task.
- A computer program is one concrete implementation of an
algorithm using a particular computer language, an
implementation of an algorithm in some programming
language like C++, Java, C#, Visual Basic, Python, and Perl.
Desirable characteristics of a program:
i) Correct: A program should do what it is supposed to do.
ii) Clear: The program logic should be easily understood.
iii) Modular: It should be broken down in sub-routines that
interact in clear ways.
iv) It should be easy to modify.
1.1 Introduction to Computer
Programming
1.1.6 Types of programming language
- There are 3 types of programming language:
• Machine Language (Low-Level language)
• Assembly Language (Low-Level language)
• High-Level language

A) MACHINE LANGUAGE: Low-level languages is machine


dependent. Any computer can directly understand only its own
machine language. Machine language is the “natural
language/mother tongue” of a computer and as such is defined
by its hardware design.
- Machine language is often referred to as object code.
- Machine language generally consist of strings of numbers
(ultimately reduced to 1’s to 0’s) that instruct computers to
perform their most elementary operations one at a time,
machine languages are machine.
1.1 Introduction to Computer
Programming
B) ASSEMBLY LANGUAGE: (Still low-level languages),
meaning it is machine dependent.
- Machine-language programming was simply too slow,
tedious and error-prone for most programmers.
- Instead of using the strings of numbers (1’s and 0’s)
programmers began to use English-like abbreviations to
represent elementary operations.
- These abbreviations formed the basis of assembly
languages.
- Translator programs called assemblers were/is developed
to convert assembly language programs to machine
language.
1.1 Introduction to Computer
Programming
C) HIGH-LEVEL LANGUAGES: Machine independent language
levels.
- Computer usage increased rapidly with the advent of
assembly languages, but programmers still had to use many
instructions to accomplish even the simplest tasks.
- To speed the programming process, high-level languages
were developed in which single statements could be written
to accomplish substantial tasks.
- Translator programs called compilers convert high-level
language programs into machine C, C++, Microsoft’s .NET
languages (i.e, Visual Basic .NET, Visual C++ .NET and Visual
C#) and Java are among the most widely used high-level
programming languages.
1.1 Introduction to Computer
Programming
1.1.7 Language translation programs
- There are three language translators:
A) ASSEMBLER: is a language translators required to
translate the assembly language into machine code.
B) COMPILER: is a language translator that translates the
entire program of high-level language (known as source
program) into a machine language, before the computer
executes the program.
C) INTERPRETER: This type of language translators converts
high-level programming languages into machine language
line-by-line, they translate a statement in a program and
execute the statement immediately, i.e, before translating
the next source language statement.
1.1 Introduction to Computer
Programming
1.1.8 Major Programming Paradigms
- The major landmarks in the programming world are the
different kinds of features or properties observed in the
development of programming languages.
- Among these the following are worth mentioning:
Procedural, Structured and Object-Oriented Programming
Paradigms.
A) PROCEDURAL PROGRAMMING: is a programming
paradigm based upon the concept of procedure call.
- Procedural programming is often a better choice than
simple sequential programming in many situations which
involve moderate complexity or which require significant
ease of maintainability.
1.1 Introduction to Computer
Programming
- Possible benefits: the ability to re-use the same code
(function or procedure) at different places, an easier way to
keep track of program flow than a collection of “GO TO” or
“JUMP” statements.
B) STRUCTURED PROGRAMMING: Process of writing a
program in small, independent parts.
- This makes it easier to control a program’s development
and to design and test its individual component parts.
- Structured programs are built up from units called modules,
which normally correspond to single procedures or
functions.
- It can be seen as a subset or sub-discipline of procedural
programming.
- It is most famous for removing or reducing reliance on the
GO TO statement.
1.1 Introduction to Computer
Programming
C) OBJECT-ORIENTED PROGRAMMING: A computer
program is composed of a collection of individual units, or
objects as opposed to traditional view in which a program is a
list of instructions to the computer.
- Object-oriented programming is claimed to give more
flexibility, easing changes to programs.
- The OOP approach is often simpler to develop and
maintain.
- Examples of object-oriented programming languages are
C++, Java, C# and Python.
1.1 Introduction to Computer
Programming
1.1.9 Generation of Programming Languages
- First generation: Machine Language (uses 0 and 1).
- Second generation: Assembly Language (uses symbols like
ADD, SUB, MUL).
- Third generation: A grouping of programming language that
introduce significant enhancements to second generation
languages, primarily intended to make programming
language more programmer – friendly.
- English words are used to denote variables, programming
structures and commands, commonly known 3GLs are
FORTRAN, BASIC, Pascal, Java and the C family (C, C+, C++,
C#, Objective C) of languages.
- Also, known as high level languages.
- Fourth generation (4GL): Example, SQL.
1.1 Introduction to Computer
Programming
Special Thanks to the publisher and author with:
TOPICS AND THE CONCEPTS:
What is computer?
What is Programming?
Problem Solving Techniques
Algorithm
Program
Language translation programs
Major programming paradigms
Generation of programming languages

REFERENCES:
C++ Programming: From Problem Analysis to Program Design (D.S. Malik)
Fundamental of Programming in C++ (Walter J. Savitch)

PRESENTED BY:
Mohammed Nebil

HISTORY OF THE PROGRAMMING:


Dennis Ritchie
Bjarne Stroustrup
Anders Hejlsberg

SPECIAL THANKS:
Digital Library of Educations
Federal Democratic Republic of Ethiopia, Ministry of Educations
Ethiopian Education Short Note

You might also like