-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscope.cpp
More file actions
70 lines (62 loc) · 2 KB
/
scope.cpp
File metadata and controls
70 lines (62 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Syeda Umm E Abiha Rizvi
// SE-21014
#include <iostream>
#include <iomanip>
using namespace std;
const double PI = 3.14;
const double RATE = 0.25;
void findArea(float, float &);
void findCircumference(float, float &);
int main()
{
cout << fixed << showpoint << setprecision(2);
float radius = 12;
cout << "Main function outer block" << endl;
cout << "PI, RATE and radius are active here \n"
<< endl;
{
float area;
cout << "Main function first inner block" << endl;
cout << "PI, RATE, radius and area are active here" << endl;
area = PI * radius * radius;
cout << "The radius = " << radius << endl;
cout << "The area = " << area << endl
<< endl;
}
{
float radius = 10;
float circumference;
cout << "Main function second inner block" << endl;
cout << "PI, RATE, radius and circumference are active here" << endl;
circumference = 2 * PI * radius;
cout << "The radius = " << radius << endl;
cout << "The circumference = " << circumference << endl
<< endl;
}
{
float area;
float circumference;
cout << "Main function after all the calls" << endl;
cout << "PI, RATE, radius, area and circumference are active here \n"
<< endl;
findArea(radius, area);
findCircumference(radius, circumference);
}
return 0;
}
void findArea(float rad, float &answer)
{
cout << "AREA FUNCTION" << endl;
cout << "PI, RATE, radius and area are active here" << endl;
answer = PI * rad * rad;
cout << "The area = " << answer << endl
<< endl;
}
void findCircumference(float length, float &distance)
{
cout << "CIRCUMFERENCE FUNCTION" << endl;
cout << "PI, RATE, radius and circumference are active here" << endl;
distance = 2 * PI * length;
cout << "The circumference = " << distance << endl
<< endl;
}