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 prism : public square{
- float a;
- public:
- void set1(float a){
- this->a = a;
- };
- float _volume(){
- return (a* sqrt(3));
- }
- };
- 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 = 0;
- prism 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;
- int count1 = 0;
- for(int i=0;i<m;i++){
- p.set1(b[i]);
- cout << "Диагональ " << i+1 << " призмы: "<< p._volume() << endl;
- if(count1 < p._volume()){
- count1=p._volume();
- }
- }
- cout<< "Призма с большей диагональю: " << count1 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement