-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProblema_1012.cpp
51 lines (40 loc) · 1.08 KB
/
Problema_1012.cpp
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
/*
@autor: Victor E. B. Rodrigues;
@data: 22/06/2021;
@nome: Área;
*/
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
double getAreaTriangulo(double& base, double& altura){
return base*altura/2.0;
}
double getAreaCirculo(double& raio, double pi = 3.14159){
return pi*(raio*raio);
}
double getAreaTrapezio(double& base1, double& base2, double& altura){
return (base1+base2)*altura/2.0;
}
double getAreaQuadrado(double& lado){
return lado*lado;
}
double getAreaRetangulo(double& base, double& altura){
return base*altura;
}
void printAreas(double& A, double& B, double& C, int precisao = 3){
cout << setprecision(precisao) << fixed;
cout << "TRIANGULO: " << getAreaTriangulo(A, C) << endl;
cout << "CIRCULO: " << getAreaCirculo(C) << endl;
cout << "TRAPEZIO: " << getAreaTrapezio(A,B,C) << endl;
cout << "QUADRADO: " << getAreaQuadrado(B) << endl;
cout << "RETANGULO: " << getAreaRetangulo(A,B) << endl;
}
int main() {
cin.tie(NULL);
cout.tie(NULL);
ios::sync_with_stdio(0);
double A, B, C;
cin >> A >> B >> C;
printAreas(A,B,C);
return 0;
}