computer engineering 2 nd semester dr. rabie a. ramadan 2

Post on 17-Jan-2016

215 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Computer Engineering 2nd Semester

Dr. Rabie A. Ramadan

http://rabieramadan.org/classes/2011/prog/

2

2

Class Rules

It will be a tough class , however,• Enjoy what you do

Do not worry about the exam as long as :• You are reading and understanding the materials in the book

I do not care how are you going to learn programming language

The section will help you to do so but it is your responsibility to dig in the subject

3

Class Rules Attendance is a must

Assignments must be delivered on time no exception whatever the reason.

The source code must be submitted with any programming assignment

Class Rules

You can bring anything to drink but NO FOOD PLEASE

When you come in , DO NOT knock on the door

When you want to leave , Do NOT tell me Just leave but you will counted as absent

5

Class Information

Text Books• Rabie Ramadan , Computer Engineering for Developers, 2011

• Other sources

• Website

• http://www.rabieramadan.org/classes/2011/prog/

Before We Start ….

25th of January

Be Smart

Programming Language Programming Language

programming language is a tool used by a programmer to give the computer very specific instructions in order to serve some purpose for the user.

A program is like a recipe.

• mix eggs, butter, sugar in a bowl

• add flour, baking soda, and flavorings

• mix until creamy

• add chocolate chips

• bake in the oven.

Can you make chocolate cake out of this recipe ?Can you make chocolate cake out of this recipe ?

Do we need more details ?Do we need more details ?

YesYes

• place two eggs in a bowl

• add 1.5 c. butter to the eggs..

• bake cookies for 10-12 minutes at 375 degrees or until brown

• Is there anything missing ?Is there anything missing ?• Well , it does not say how to put the eggs shelled or not. Well , it does not say how to put the eggs shelled or not.

• It adds some illustrations It adds some illustrations

Computer ProgrammingComputer Programming

Computer does not understandComputer does not understand

You need to tell it every detailsYou need to tell it every details

Therefore, we have languages to tell the computer what to Therefore, we have languages to tell the computer what to do. do.

Is it only one language ?Is it only one language ?

No,No,

There are many languages There are many languages

Each one is designed with a purpose in mind Each one is designed with a purpose in mind

What is behind the high level What is behind the high level language? language?

Computer does not understand the high level language Computer does not understand the high level language

The program must be translated to the machine language The program must be translated to the machine language

Compiler / Interpreter Compiler / Interpreter

Source CodeSource Code Compiler / Interpreter Compiler / Interpreter Object CodeObject Code

Compiler/ Interpreter Compiler/ Interpreter

Why C++?Why C++?

C++ allows expression of abstract ideas

C++ is a third generation language that allows a programmer to express their ideas at a high level as compared to assembly languages.

C++ still allows a programmer to keep low-level control

it has some of the "feel" of an assembly language.

Why C++?Why C++?

C++ has national standards (ANSI)

Code written in C++ that conforms to the national standards can be easily integrated with preexisting code.

C++ is reusable and object-oriented

C++ is widely used and taught

Structure of a program

Line separation

Multiple instructions

Type of Structuring

Comments

C++’ Names The name of a variable: Starts with an underscore “_” or a letter, lowercase or uppercase, such as a letter from a to z or from A to Z.

Examples are Name, gender, _Students, pRice

Can include letters, underscore, or digits. Examples keyboard, Master, Junction, Player1, total_grade, _Score_Side1

C++’ Names

Cannot include special characters such as !, %, ], or $

Cannot include an empty space

Cannot be any of the reserved words

Should not be longer than 32 characters (although allowed)

Reserved keywords

Data Types

A Byte

Data Types

Character

Data Types

\

Reading Assignment

26

Please Read:

•Program Structure, Variables, Data Types, and Constants

•Operators and Operands

•Basic Input/Output

top related