Presentation is loading. Please wait.

Presentation is loading. Please wait.

Engineering 1020 Introduction to Programming

Similar presentations


Presentation on theme: "Engineering 1020 Introduction to Programming"— Presentation transcript:

1 Engineering 1020 Introduction to Programming
WELCOME Engineering Introduction to Programming Dr. Mohamed Shehata Fall 2017

2 Course Walkthrough Course website: Course outline
Course outline

3 Computer Programming The transition from human beings performing calculations without the aid of a device to machines that stored the instructions for their operations forms the basis for the evolution of computer programming

4 Why Study Programming? Computers are fast and accurate in computation
Virtually ALL engineers use computers in some way Engineers are responsible for the input and output of the programs they use It is likely that you will have to write some programs some time Programming skills are needed in other courses Programming/problem solving skills from this course can be applied to other areas It is fun!

5 Applications Can range from high critical mission (Defence application / Robots) to commercial (Mobile devices, word processing, databases) or even pleasure and Fun (PolMaster)

6 What is a Computer? A Literal Definition
A device that computes, especially a programmable electronic machine that performs high-speed mathematical or logical operations or that assembles, stores, correlates, or otherwise processes information A programmable device that can store, retrieve, and process data. Not “Smart”, just fast and accurate Needs very specific instructions Can do some things well: Arithmetic and Logic Comparison Data processing: input, output, storage, and copying

7 What inside the Computer ?

8 And here's how we would view the 3pi robot

9 Computer Components Input devices (mouse, keyboard) which let us input data into a computer Output devices (screen, printer) which let us view data. Memory devices, which let us store data, and are subdivided into volatile memory (RAM) which loses data when the power is off non-volatile memory (disks of various kinds) which hold data when power is off. The CPU (Central Processing Unit) which processes all data. The Data Highway (Bus) which is used to move data among IO, memory and CPU When we send data to memory we say we write the data When we fetch data from memory we say we read the data.

10 Computer Programing Computer programming is traditionally thought of as problem-solving process. A computer program is a solution to a problem. A computer program is set of instructions (such as add two numbers or print the answer) to a computer bundled together for doing some common set of tasks (such as word processing or mathematical modeling). Most of the instructions in a program involve the processing of data. Engineering 2420 Structured Programming --- Introduction

11 How Computer Works Computers process data sequentially.
One or more pieces of data are read from memory (one at a time) The data is processed in the CPU The results are written back into memory (one at a time) Computer Programs Data processing is carried out using a set of instructions known as a program. The program itself is a form of computer data and is stored in computer memory. Instructions are fetched, one at a time from computer memory to the CPU Then they are executed (carried out) by the CPU.

12 Complexity Computer programs are among the most complex artifacts engineered by humankind. To manage complex algorithms, we use a strategy known as Divide and Conquer Complex systems are modularized: broken into smaller more manageable pieces The modules themselves are often broken into smaller modules, and those into smaller modules again. The set of modules is organized hierarchically to constitute the system

13

14

15 Function: Instruction
The fundamental module of code. All code must appear inside some function, even if it's only main. Functions may return a value or void. Instruction The smallest increment of computer code which can carry out a task. A function body normally contains one or more instructions. Instructions are usually issued to an underlying machine. Also called a statement.

16 (This one is a function call)
Main Program Logic Drive Ahead Calibrate Turn Left Program follow line Call: instruction Another instruction (This one is a function call)

17 These instructions come one after another in an ordered sequence
These instructions come one after another in an ordered sequence. That is how they are executed when they are run on the computer. The first instruction is executed Then the second instruction is executed Then the third instruction is executed

18 First Program

19 Go to cpp.sh Copy and paste the following code: // Example program #include <iostream> using namespace std; int main() { cout << "Hello, Class!"; cout<<"\n Today is great"; return 0; } You can change Hello Class! And change Today is great with whatever you want – make sure you keep the double quotation Click the Run button on the lower right corner You should see the text you wrote appear on in the execution part of the window at the bottom. See next slide

20


Download ppt "Engineering 1020 Introduction to Programming"

Similar presentations


Ads by Google