Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- using namespace std;
- class square{
- float a;
- public:
- void set(float a){
- this->a = a;
- }
- float _square(){
- return a*a;
- }
- float _perimeter(){
- return 4*a;
- }
- float _diagonal(){
- return sqrt(a*a + a*a);
- }
- };
- class pyramid : public square{
- float h;
- public:
- void set1(float h){
- this->h = h;
- };
- float _volume(){
- return (0.3 * h * _square());
- }
- };
- int main() {
- int n,m,h;
- vector <int> a,b;
- cin >> n >> m >> h;
- for(int i=0;i<n;i++){
- int temp;
- cin >> temp;
- a.push_back(temp);
- }
- for(int i=0;i<m;i++){
- int temp;
- cin >> temp;
- b.push_back(temp);
- }
- int count = 999999;
- pyramid p;
- for(int i=0;i<n;i++){
- p.set(a[i]);
- p._square();
- cout << "Площадь " << i+1 << " квадрата: " << p._square() << endl;
- if(count > p._square()){
- count = p._square();
- }
- }
- cout << "Минимальная площадь квадрата: " << count << endl;
- for(int i=0;i<m;i++){
- p.set1(b[i]);
- cout << "Объем " << i+1 << " пирамиды: "<< p._volume() << endl;
- if(b[i] > h){
- cout << i+1 << " пирамида имеет h больше заданной: " << b[i] << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement