Advertisement
evcamels

lr-5-19(4)

Nov 17th, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. //
  2. // main.cpp
  3. // lr-5-4
  4. //
  5. // Created by Nikita Korvyakov on 17.11.2020.
  6. // Copyright © 2020 Nikita Korvyakov. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include <cmath>
  11. #include <vector>
  12. using namespace std;
  13. class square{
  14. float a;
  15. public:
  16. void set(float a){
  17. this->a = a;
  18. }
  19. float _square(){
  20. return a*a;
  21. }
  22. float _perimeter(){
  23. return 4*a;
  24. }
  25. float _diagonal(){
  26. return sqrt(a*a + a*a);
  27. }
  28. };
  29. class pyramid : public square{
  30. float h;
  31. public:
  32. void set1(float h){
  33. this->h = h;
  34. };
  35. float _volume(){
  36. return (0.3 * h * _square());
  37. }
  38. };
  39. int main() {
  40. int n,m,h;
  41. vector <int> a,b;
  42. cin >> n >> m >> h;
  43. for(int i=0;i<n;i++){
  44. int temp;
  45. cin >> temp;
  46. a.push_back(temp);
  47. }
  48. for(int i=0;i<m;i++){
  49. int temp;
  50. cin >> temp;
  51. b.push_back(temp);
  52. }
  53. int count = 999999;
  54. pyramid p;
  55. for(int i=0;i<n;i++){
  56. p.set(a[i]);
  57. p._square();
  58. cout << "Площадь " << i+1 << " квадрата: " << p._square() << endl;
  59. if(count > p._square()){
  60. count = p._square();
  61. }
  62. }
  63. cout << "Минимальная площадь квадрата: " << count << endl;
  64. for(int i=0;i<m;i++){
  65. p.set1(b[i]);
  66. cout << "Объем " << i+1 << " пирамиды: "<< p._volume() << endl;
  67. if(b[i] > h){
  68. cout << i+1 << " пирамида имеет h больше заданной: " << b[i] << endl;
  69. }
  70. }
  71. return 0;
  72. }
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement