fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <iostream>
  4. #include <iomanip>
  5. #include <math.h>
  6.  
  7. int main(int argc, char** argv) {
  8. double pi = 3.14159;
  9. double a, b, c;
  10. double area_triangulo, area_circulo, area_trapezio,
  11. area_quadrado,area_retangulo;
  12.  
  13. std::cin >> a >> b >> c;
  14.  
  15. area_triangulo = a * c / 2;
  16. area_circulo = pi * pow(c, 2);
  17. area_trapezio = ((a + b)* c)/2;
  18. area_quadrado = pow(b, 2);
  19. area_retangulo = a * b;
  20.  
  21. std::cout << std::fixed << std::setprecision(3);
  22. std::cout << "TRIANGULO: " <<area_triangulo << std::endl;
  23. std::cout << "CIRCULO: " <<area_circulo << std::endl;
  24. std::cout << "TRAPEZIO: " <<area_trapezio << std::endl;
  25. std::cout << "QUADRADO: " <<area_quadrado << std::endl;
  26. std::cout << "RETANGULO: " <<area_retangulo << std::endl;
  27.  
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 4460KB
stdin
3.0
4.0
5.2
stdout
TRIANGULO: 7.800
CIRCULO: 84.949
TRAPEZIO: 18.200
QUADRADO: 16.000
RETANGULO: 12.000