C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.

Slides:



Advertisements
Similar presentations
Chapter 1 An Overview of Computers and Programming Languages.
Advertisements

Chapter 1: An Overview of Computers and Programming Languages
Overview of Computers & Programming Languages Chapter 1.
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
CHAPTER 1: AN OVERVIEW OF PROGRAMMING INSTRUCTOR: MOHAMMAD MOJADDAM How to Program in C++
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages Updated by: Dr\Ali-Alnajjar.
CHAPTER 1 AN OVERVIEW OF COMPUTERS AND PROGRAMMING LANGUAGES.
Chapter 1: An Overview of Computers and Programming Languages.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
About the Presentations The presentations cover the objectives found in the opening of each chapter All chapter objectives are listed in the beginning.
Chapter 1 An Overview of Computers and Programming Languages.
EGR 2261 Engineering Problem Solving Using C and C++ Professor Nick Reeder.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 1: An Overview of Computers and Programming Languages.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 1: An Overview of Computers and Programming Languages.
Overview of Programming and Problem Solving. Objectives In this chapter you will: Learn about different types of computers Explore the hardware and software.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 1: An Overview of Computers and Programming Languages.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1 An Overview of Computers and Programming Languages.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction to Programming By: Prof. Muhammad Abu Baker Siddique 2 nd Lecture 1.
Chapter 1: Introduction to Computers and Programming
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
Engineering Problem Solving Using C and C++ Professor Nick Reeder
Chapter 1: An Overview of Computers and Programming Languages
Engineering Problem Solving With C An Object Based Approach
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
About the Presentations
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Overview of Computers & Programming Languages
Chapter 1: Introduction to Computers and Programming
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
Topics Introduction Hardware and Software How Computers Store Data
Chapter 1: An Overview of Computers and Programming Languages
Reminders Please turn off cell phones.
Presentation transcript:

C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages

Introduction Without software, the computer is useless Software developed with programming languages –C++ is a programming language C++ suited for a wide variety of programming tasks Before programming, it is useful to understand terminology and computer components C++ Programming: From Problem Analysis to Program Design, Fifth Edition2

Elements of a Computer System Hardware CPU Main memory Secondary storage Input/Output devices Software C++ Programming: From Problem Analysis to Program Design, Fifth Edition3

Hardware CPU Main memory: RAM Input/output devices Secondary storage C++ Programming: From Problem Analysis to Program Design, Fifth Edition4

Central Processing Unit and Main Memory Central processing unit –Brain of the computer –Most expensive piece of hardware –Carries out arithmetic and logical operations C++ Programming: From Problem Analysis to Program Design, Fifth Edition5

Central Processing Unit and Main Memory (cont'd.) C++ Programming: From Problem Analysis to Program Design, Fifth Edition6

Central Processing Unit and Main Memory (cont'd.) Random access memory Directly connected to the CPU All programs must be loaded into main memory before they can be executed All data must be brought into main memory before it can be manipulated When computer power is turned off, everything in main memory is lost C++ Programming: From Problem Analysis to Program Design, Fifth Edition7

Secondary Storage Secondary storage: device that stores information permanently Examples of secondary storage: –Hard disks –Flash drives –Floppy disks –CD-ROMs –Tapes C++ Programming: From Problem Analysis to Program Design, Fifth Edition8

Input/Output Devices Input devices feed data and programs into computers –Keyboard –Mouse Output devices display results –Monitor –Printer C++ Programming: From Problem Analysis to Program Design, Fifth Edition9

Software Software: programs that do specific tasks System programs take control of the computer, such as an operating system Application programs perform a specific task C++ Programming: From Problem Analysis to Program Design, Fifth Edition10

The Language of a Computer Digital signals: sequences of 0s and 1s Machine language: language of a computer Binary digit (bit): –The digit 0 or 1 Binary code: –A sequence of 0s and 1s Byte: –A sequence of eight bits C++ Programming: From Problem Analysis to Program Design, Fifth Edition11

The Language of a Computer (cont’d.) C++ Programming: From Problem Analysis to Program Design, Fifth Edition12

The Language of a Computer (cont'd.) ASCII (American Standard Code for Information Interchange) –128 characters –A is encoded as (66th character) –3 is encoded as C++ Programming: From Problem Analysis to Program Design, Fifth Edition13

The Language of a Computer (cont'd.) EBCDIC –Used by IBM –256 characters Unicode –65536 characters –Two bytes are needed to store a character C++ Programming: From Problem Analysis to Program Design, Fifth Edition14

The Evolution of Programming Languages Early computers were programmed in machine language To calculate wages = rates * hours in machine language: //Load //Multiply //Store C++ Programming: From Problem Analysis to Program Design, Fifth Edition15

The Evolution of Programming Languages (cont'd.) Assembly language instructions are mnemonic Assembler: translates a program written in assembly language into machine language C++ Programming: From Problem Analysis to Program Design, Fifth Edition16

Processing a C++ Program #include using namespace std; int main() { cout << "My first C++ program." << endl; return 0; } Sample Run: My first C++ program. C++ Programming: From Problem Analysis to Program Design, Fifth Edition17

Processing a C++ Program (cont'd.) C++ Programming: From Problem Analysis to Program Design, Fifth Edition18

Programming with the Problem Analysis–Coding–Execution Cycle Programming is a process of problem solving One problem-solving technique: –Analyze the problem –Outline the problem requirements –Design steps (algorithm) to solve the problem Algorithm: –Step-by-step problem-solving process –Solution achieved in finite amount of time C++ Programming: From Problem Analysis to Program Design, Fifth Edition19

The Problem Analysis–Coding– Execution Cycle (cont’d.) C++ Programming: From Problem Analysis to Program Design, Fifth Edition20

The Problem Analysis–Coding– Execution Cycle (cont'd.) Run code through compiler If compiler generates errors –Look at code and remove errors –Run code again through compiler If there are no syntax errors –Compiler generates equivalent machine code Linker links machine code with system resources C++ Programming: From Problem Analysis to Program Design, Fifth Edition21

The Problem Analysis–Coding– Execution Cycle (cont'd.) Once compiled and linked, loader can place program into main memory for execution The final step is to execute the program Compiler guarantees that the program follows the rules of the language –Does not guarantee that the program will run correctly C++ Programming: From Problem Analysis to Program Design, Fifth Edition22

Example 1-1 Design an algorithm to find the perimeter and area of a rectangle The perimeter and area of the rectangle are given by the following formulas: perimeter = 2 * (length + width) area = length * width C++ Programming: From Problem Analysis to Program Design, Fifth Edition23

Example 1-1 (cont'd.) Algorithm: –Get length of the rectangle –Get width of the rectangle –Find the perimeter using the following equation: perimeter = 2 * (length + width) –Find the area using the following equation: area = length * width C++ Programming: From Problem Analysis to Program Design, Fifth Edition24