A Quick Look at C++
A simple and basic C++ code example. Explore your logical understanding of programming wither you are a beginner or it is your first C++ encounter.
download
Export
search_insights
Statistics
stylus_note
White Board

calculate
Calculator
QUESTION
OF
Read through this program and answer the following questions
1 //**************************************************************
2 // Given the length and width of a rectangle, this C++ program
3 // computes and outputs the perimeter and area of the rectangle.
4 //**************************************************************
5
6 #include <iostream>
7 using namespace std;
8
9 int main()
10 {
11 double length;
12 double width;
13 double area;
14 double perimeter;
15
16 cout << "Program to compute and output the perimeter and " << "area of a rectangle." << endl;
17
19 length = 6.0;
20 width = 4.0;
21 perimeter = 2 * (length + width);
22 area = length * width;
23 cout << "Length = " << length << endl;
24 cout << "Width = " << width << endl;
25 cout << "Perimeter = " << perimeter << endl;
26 cout << "Area = " << area << endl;
27 return 0;
28 }
Β