Programming With C++ Chapter01-2
Programming With C++ Chapter01-2
Programming With C++ Chapter01-2
Business
Medicine
Government
Law Enforcement
Agriculture
Academics
Entertainment
1-7
Artistry in programming:
• Organization of the tasks that the program performs
• How information is displayed
• How the user interacts with the program
1-8
Science in programming:
• Understanding of the language used to write the program
• Understanding how to test the program, and to change it if it
does not work as intended
ENIAC
▪World’s first programmable
computer
▪ Built in 1945
▪ Designed to calculate artillery
ballistic tables for the U.S. Army
▪ CPU was 8 feet tall, 100 feet long,
and weighed 30 tons
Microprocessor
▪ Much smaller
▪ Much more powerful
1-9
1-10
Main Memory
• Holds both program instructions and data
• Volatile – erased when the program terminates, or
computer is turned off
• Also called Random Access Memory (RAM), because
the CPU can access data and instructions from any
memory location.
1-14
• Byte
–Is 8 consecutive bits
–Has an address in memory
–There are billions of bytes of memory in a computer
1-15
Secondary Storage
Input Devices
Output Devices
categories
• System software
– programs that manage the computer hardware and the
programs that run on the computer
– Operating Systems
▪Controls the operation of the computer
▪ Manages connected devices and access to storage devices
▪ Allows programs to run
– Utility Programs
▪ Support programs that enhance computer operations
▪ Examples: virus scanners, data backup, file compression
– Software development tools
▪ Used by programmers to create software
▪ Examples: compilers, integrated development environments
(IDEs)
1-20
• This corresponds to the binary numbering system where all numeric values are written as a
sequence of 0s and 1s
1-21
How Computers Store Data
Storing Numbers
1-22
How Computers Store Data
Storing Numbers
• The largest value that can be stored in a byte with eight bits is 255
• Two bytes are used for larger numbers; maximum value is 65535
1-23
How Computers Store Data
Storing Characters
• Characters are stored in the computer’s memory as a
binary number
1-24
1-25
How Computers Store Data
Storing Characters
• ASCII is a set of 128 numeric codes
• ASCII is limited
1-26
Unicode
1-27
CPU is designed to perform the following operations:
• Program
a set of instructions directing a computer to perform a task
• Programming Language
a special language used to write programs
1-30
1011010000000101
Types of languages
– Medium Level
▪ Slice 4 apples into one-inch squares...
1-38
The statements written in a high-level language are called
source code or simply code
1-39
Compilation – How to we get from the left 1-40
1-41
1-42
1-44
Mistakes compilers catch and don’t catch:
1-45
Some Well-Known Programming Languages
Programming Languages
• FORTRAN - Scientific/Engineering (1957)
• COBOL - business oriented language (1959)
• C - applications and systems, dominated much of the eighties
and early nineties. (K&R published 1978)
• C++ - applications and systems, dominated much of the late
nineties. (1980-1985)
• Java - applications and network/web-based applications,
rapidly gaining popularity. (1995)
• Lisp and Prolog - Languages for AI (1959, 1970)
• Pascal - language used to teach programming (1971)
• Ada - language used in military applications (1983)
• Basic - language used to teach programming (1965)
What is C++? 1-48
–Key Words
–Programmer-Defined
Identifiers
–Operators
–Punctuation
–Syntax
Key Words
Variables
Variables
Variables
Variables