SHARE
TWEET

Untitled

a guest Nov 21st, 2019 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ConsoleApplication2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <time.h>
  6. #include <cstdio>
  7. #include <string>
  8.  
  9.  
  10. using namespace std;
  11.  
  12. #include <iostream>
  13. #include <stdio.h>
  14. #include <tchar.h>
  15. #include <math.h>
  16.  
  17. class Figura {
  18. public:
  19.     virtual double pole() {
  20.         return 0.0;
  21.     }
  22.     virtual double obwod() {
  23.         return 0.0;
  24.     }
  25. };
  26.  
  27. class Prostokat : public Figura {
  28. protected:
  29.     double a;
  30.     double b;
  31. public:
  32.     Prostokat(double a, double b) {
  33.         this->a = a;
  34.         this->b = b;
  35.     }
  36.     ~Prostokat() {}
  37.     virtual double pole() {
  38.         return (this->a*this->b);
  39.     }
  40.     virtual double obwod() {
  41.         return (this->a * 2 + this->b * 2);
  42.     }
  43. };
  44.  
  45. class Elipsa {
  46. protected:
  47.     double a;
  48.     double b;
  49. public:
  50.     Elipsa(double a, double b) {
  51.         this->a = a;
  52.         this->b = b;
  53.     }
  54.     ~Elipsa() {}
  55.     double pole() {
  56.         return (this->a*this->b*3.14);
  57.     }
  58.     double obwod() {
  59.         return ((3 / 2)*(this->a + this->b) - (sqrt(this->a + this->b))*3.14);
  60.     }
  61. };
  62.  
  63. class Kwadrat : public Prostokat {
  64.     friend std::ostream& operator<< (std::ostream &out, const Kwadrat &val);
  65. public:
  66.     Kwadrat(double a) : Prostokat(a, a) { };
  67. };
  68.  
  69. class Okrag :public Elipsa {
  70. public:
  71.     Okrag(double r) : Elipsa(r, r) {};
  72.     double pole() {
  73.         return Elipsa::a*Elipsa::b*3.14;
  74.     }
  75.     double obwod() {
  76.         return 2 * Elipsa::a*3.14;
  77.     }
  78. };
  79.  
  80. std::ostream& operator<< (std::ostream &out, const Kwadrat &val) {
  81.    
  82.     out << val.a;
  83.     return out;
  84. }
  85.  
  86. int main(void) {
  87.    
  88.     return 0;
  89. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top