ch01_overview of computers and programming languages.ppt
1.
C++ Programming: FromProblem
Analysis to Program Design, Fifth Edition
Chapter 1: An Overview of
Computers and Programming
Languages
Updated by: Malak Abdullah
2.
Updated by: MalakAbdullah
The Evolution of Programming Languages
(cont'd.)
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2
3.
Updated by: MalakAbdullah
Processing a C++ Program
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 3
4.
Updated by: MalakAbdullah
Processing a C++ Program (cont'd.)
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 4
5.
Updated by: MalakAbdullah
Processing a C++ Program (cont'd.)
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 5
6.
Updated by: MalakAbdullah
Processing a C++ Program (cont'd.)
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 6
7.
Updated by: MalakAbdullah
Programming with the Problem Analysis–
Coding–Execution Cycle
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 7
8.
Updated by: MalakAbdullah
The Problem Analysis–Coding–Execution
Cycle (cont’d.)
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 8
9.
Updated by: MalakAbdullah
The Problem Analysis–Coding–Execution
Cycle (cont'd.)
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 9
10.
Updated by: MalakAbdullah
The Problem Analysis–Coding–Execution
Cycle (cont'd.)
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 10
11.
Updated by: MalakAbdullah
Example 1-1
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 11
12.
Updated by: MalakAbdullah
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 Edition 12
13.
Updated by: MalakAbdullah
WAP a C++ Program
parameter = 2 * (length + width)
area = length * width
#include <iostream>
using namespace std;
int main()
{
int length, width, parameter, area; // variables
cout << "Enter length & Width: ";
cin >> length >> width;
parameter = 2 * (length + width);
area = length * width;
cout << "Parameter is :" << parameter << endl;
cout << "Area is :" << area << endl;
return 0;
}
Sample Run:
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 13