introduction to c++ programming cs 117 section 2 and knet sections spring 2001 mwf 1:40-2:30

28
Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

Post on 21-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

Introduction to C++ Programming

CS 117

Section 2 and KNET Sections

Spring 2001

MWF 1:40-2:30

Page 2: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

Introduction to C++ Programming

Instructor: Teresa ColeOffice: MEC 302LPhone: 426-2485 Email: [email protected]

Office Hours: (tentative)Monday 3:00 - 4:00 pm Tuesday 9:00 - 10:00 am Wednesday 3:30 - 4:30 pm Thursday 11:00 - 12:00 am Friday 9:40 - 10:40 am

Page 3: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

Internet Resources

There will be an email list for this class which all students are

required to subscribe to.

The course web page

http://cs.boisestate.edu/~tcole/cs117/

Page 4: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

Textbooks

Choose fromEssential C++ for Engineers and Scientists by Jeri R. Hanly Problem Solving, Abstraction and Design Using C++ by Frank L. Friedman and Elliot B. Koffman

Page 5: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

Programming

All students will have accounts on emerald, a Computer Science

Department computer running the Linux operating system

Programs will be submitted and graded on emerald

Page 6: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

Programming

Development may be done on any computer It is the responsibility of the student to be sure that programs run on emerald. Programs that don't run on emerald will receive a maximum score of 60%.

Page 7: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

7

Computer Components

Page 8: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

8

Every computer is organized roughly into six parts– CPU - central processing unit

• Where decisions are made, computations are performed, and input/output requests are delegated

– Main Memory• Stores information being processed by the CPU

– Secondary Memory• Stores data and programs

1.2 Computer Hardware

Page 9: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

9

– Input devices• Allows people to supply information to computers

– Output devices• Allows people to receive information from

computers

– Network connection• Modems / Ethernet interface

Computer Hardware

Page 10: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

10

Main Memory

-27.2

354

.005

75.62

Address Contents

0

1024

1

Page 11: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

11

Main Memory

Stores – programs– data– results

Types– RAM– ROM

Page 12: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

12

Secondary Memory & Storage

Semi permanent data-storage capability– Tape or Disk– Hard disk– CD ROM

Secondary memory has much more storage capacity

Page 13: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

13

CPU

“Brains” of the computer– Arithmetic calculations are performed using the

Arithmetic/Logical Unit or ALU– Control unit decodes and executes instructions

Arithmetic operations are performed using binary number system

Page 14: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

14

Input / Output Devices Accessories that allow computer to perform

specific tasks– Receiving information for processing– Return the results of processing– Store information

Common input and output devices– Printer Joystick CD-ROM– Keyboard Monitor

Page 15: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

15

Computer Networks

LAN - Local area network– Organizational

WAN - Wide area network– Internet

Page 16: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

16

Application software– Programs designed to perform specific tasks that

are transparent to the user System software

– Programs that support the execution and development of other programs

– Two major types• Operating systems• Translation systems

1.3 Computer Software

Page 17: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

17

Application Software Application software is the software that has

made using computers indispensable and popular Common application software

– Word processors– Desktop publishing programs– Spreadsheets– Presentation managers– Drawing programs

Page 18: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

18

Controls and manages the computing resources Important services that an operating system provides

– File system

– Commands that allow for manipulation of the file system

– Ability to perform input and output on a variety of devices

– Management of the running systems Examples

– MSDOS ®, Windows ®, Unix ®

Operating System

Page 19: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

19

Programming Languages Machine Language

– “Native tongue” of the computer– Binary 0s and 1s that specify what to do

• 0010 0000 0000 0100• 1000 0000 0000 0101• 0011 0000 0000 0110

High - Level Languages– Resemble human language (C++, C, Pascal)

• cost = price + tax;

Page 20: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

20

OO Programming and Structured Programming

Object-oriented design and programming supports good software engineering

Object-oriented design promotes thinking about software in a way that models the real world

Page 21: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

21

OO Programming and Structured Programming

Algorithms are the basis for the procedural sections (Structured Programs)– Highly structured– Top-down design– Step-wise refinement

Page 22: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

22

Object Oriented Design Modularity

– Dividing an object into smaller pieces or modules such that the object is easier to understand and manipulate

Hierarchy – Ranking or ordering of objects based on some

relationship between them

Page 23: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

23

OO Classes

Later we will use data abstractions– C++ language

Will apply OO techniques – Structured Programming– Object Oriented Programming

Model our own objects or abstractions

Page 24: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

24

Processing a Program Editor used to enter the program

– Source program (file.cpp)– UNIX vi text editor

Compiler translates the source program– Displays syntax errors (not descriptive)

Linker/Loader to combine object file with other object files– Executable program

Page 25: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

25

Process Cycle

Page 26: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

Software Development Method

Problem AnalysisDesignImplementationTestingDocumentation

Page 27: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

27

Applying the Software Development Method

– Analysis  The first step in solving this problem is to determine what you are asked to do. You must convert from one system of measurement to another, but are you supposed to convert from kilometers to miles, or vice versa? The problem states that you prefer to deal in metric measurements, so you must convert distance measurements in miles to kilometers.

Page 28: Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30

28

Applying the Software Development Method

– Design  The next step is to formulate the algorithm that solves the problem. Begin by listing the three major steps, or sub problems, of the algorithm.

– Implementation  To implement the solution, you must write the algorithm as a C++ program.

– Testing  How do you know the sample run is correct?