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
Quran
QUESTION
OF
calculate
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 }
0
sin
cos
tan
sin-1
cos-1
tan-1
π
e
xy
x3
x2
ex
10x
y√x
3√x
√x
ln
log
(
)
1/x
%
n!
7
8
9
+
MS
4
5
6
–
M+
1
2
3
×
M-
0
.
EXP
÷
MR
±
RND
C
=
MC
|
Document Actions