Introduction to Programming

coordinatedcapableΛογισμικό & κατασκευή λογ/κού

4 Νοε 2013 (πριν από 3 χρόνια και 7 μήνες)

60 εμφανίσεις

Introduction to Programming

When you program,
you are programming
the instruction set of
the CPU (machine

Intel 8080 CPU

Machine Language / Assembly Language

The only programming language a CPU can directly execute
is machine language (or machine code).

Since machine language

instructions are in binary,

Assembly Language is created

to allow a programmer to code

the instructions in a familiar

language, then compile these

instructions into machine


With Assembly Language,

you are still programming using

the instruction set of the CPU.

The Hierarchy of Programming Languages



Worksheet, Document

Access, Excel, Word

C++, Java, C#

Assembly Language

Machine Language



Lower Level

Higher Level





#include <iostream.h>



int Total,Kiwi,Bananas;

Kiwi = 5;

Bananas = 6;

Total = Kiwi + Bananas;

cout << Total << endl;


Compiled versus Interpreted


translates an entire program (source code)
into machine language for execution by the CPU. The
result is an executable (.exe) file that can be run on a

A = 5


B = A + 3


Print B



translates or compiles a program one line
at a time while it is executing. An older example of an
interpreted language is Basic. A newer example is

Enter temperature in Fahrenheit: 75

It is 23.8889 degrees Celsius.

#include <iostream.h>

float Convert(float);



float F,C;

cout << "Enter temperature in Fahrenheit: ";

cin >> F;

C = Convert(F);

cout << "It is " << C << " degrees Celsius.


float Convert (float F)


float C = (5.0/9.0) * (F


return C;


Structured Programming

Program Source Code

Program Output

In structured programming, common
tasks such as converting Fahrenheit to
Celsius are put into separate reusable
modules called functions.

These modules/functions may be used
as often as needed and they can be
reused in other programs.

DeckofCards Lucky; // define object

to be a deck of cards

Player Kirk; // define object

to be a player

Lucky.Shuffle; // shuffle the deck of cards

Lucky.Cut; // cut the deck or cards

Kirk.Cards = Lucky.Deal(5); // deal 5 cards to Kirk

Kirk.ShowCards; // display the cards

Kirk.PokerHand; // display poker hand

Object Oriented Programming (OOP)

Full House

Program Source Code

Program Output

oriented programming (OOP) is a newer approach to program design. It focuses
on creating objects. Objects have both properties (data) and methods (functions). For
example, an object might be a deck of cards. It’s properties are the number and order of
the cards. Its methods/functions are shuffling, cutting, dealing, etc.

Software Development Life Cycle



Problem Analysis

System analysts study the problem and define
the specifications for the software.

Program Design

The specifications are used to develop an
algorithm for the program

Program Coding

Programmers produce the code for the program.
Alpha versions of the program are created.

Program Debugging and Testing

Program testing may be done in
house, or a Beta
version may be produced to allow end
users test
the program.

Program Implementation and

After the program is put into production, the
maintenance phase begins. New versions will be
released to fix bugs and add requested

Programming Languages



Machine Language

The native programming language of the computer's CPU. This low
level language is tedious

CPUs come with a
specified set of very basic instructions and operations. For example, a

instruction will move each piece
of data from memory to a register on the CPU for processing. Machine language is written in binary

all 1's
and 0's.

Assembly Language

A fancier way to write machine language. This low
level language allows instructions to be written in a more
understandable format (instead of binary), then converted to machine language.


A high
level structured, procedural programming language that is widely used for programming applications as well
as operating systems. It was developed on a UNIX system and later used to reprogram UNIX.


A high
level object oriented programming language that is a superset of C. Originally designed by Bjarne
Stroustrup of AT&T's Bell Labs in 1979. It adds better type checking, data abstraction, and object oriented
programming to C.


Pronounced C
Sharp, this programming language was developed by Microsoft for its .NET Framework. In many
ways, it is an upgrade to C++ and was made to compete with the Java language.


An early high
level programming language that is simple to use and widely popular. Many of the first home
computers in the 1970's and 1980's included this programming language.


COBOL (Common Business Oriented Language) was the first widely used high
level language for business
applications such as payroll and accounting. This older programming language has been updated and is still
used today, mostly on mainframe computers.


FORTRAN (Formula Translation) is an older high
level language that was designed for scientific applications.


Pascal is an older high
level language that was also designed for math and science applications. It was popular as a
teaching tool for structured programming before C became popular.

Visual Basic (VB)

Microsoft's Visual Basic adds object
oriented features and a graphical user interface to the standard BASIC


A high
level object
oriented programming language developed by Sun Microsystems for creating applets that are
platform independent. A Java applet (.class file) will execute on any operating system that has the Java run
time console installed. Java applets first became popular as programs that execute within a web browser.


A scripting language used in web pages that enhances the limited capabilities of HTML. JavaScript adds many
functions to HTML including as cookies and pop
up windows.