CSCI - Chapter 1
CSCI - Chapter 1
Chapter 1: An Overview of
Computers and Programming
Languages
Objectives
In this chapter, you will:
• Learn about different types of computers
• Explore the hardware and software
components of a computer system
• Learn about the language of a computer
• Learn about the evolution of programming
languages
• Examine high-level programming
languages
C++ Programming: Program Design Including Data Structures, Fifth Edition 2
Objectives (cont'd.)
• Discover what a compiler is and what it
does
• Examine a C++ program
• Explore how a C++ program is processed
• Learn what an algorithm is and explore
problem-solving techniques
• Become aware of structured design and
object-oriented design programming
methodologies
• Become aware of Standard C++ and
ANSI/ISO Standard C++
C++ Programming: Program Design Including Data Structures, Fifth Edition 3
Introduction
LOAD rate
MULT hours
STOR wages
Sample Run:
My first C++ program.
perimeter = 2 * (length +
width)
area = length * width
C++ Programming: Program Design Including Data Structures, Fifth Edition 36
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
• Get totalSales
C++ Programming: Program Design Including Data Structures, Fifth Edition 40
Example 1-3 (cont'd.)
• Calculate additionalBonus as follows:
if (totalSale is less than 5000)
additionalBonus = 0
otherwise
if (totalSale is greater than or equal to
5000 and totalSale is less than 10000)
additionalBonus = totalSale · (0.03)
otherwise
additionalBonus = totalSale · (0.06)