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
TRANSCRIPT
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
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/
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
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
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%.
7
Computer Components
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
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
10
Main Memory
-27.2
354
.005
75.62
Address Contents
0
1024
1
11
Main Memory
Stores – programs– data– results
Types– RAM– ROM
12
Secondary Memory & Storage
Semi permanent data-storage capability– Tape or Disk– Hard disk– CD ROM
Secondary memory has much more storage capacity
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
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
15
Computer Networks
LAN - Local area network– Organizational
WAN - Wide area network– Internet
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
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
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
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;
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
21
OO Programming and Structured Programming
Algorithms are the basis for the procedural sections (Structured Programs)– Highly structured– Top-down design– Step-wise refinement
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
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
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
25
Process Cycle
Software Development Method
Problem AnalysisDesignImplementationTestingDocumentation
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.
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?