Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class figura
- {
- public:
- virtual double pole()
- {
- };
- };
- class kwadrat:public figura
- {
- private:
- int a;
- public:
- kwadrat()
- {
- a=0;
- };
- double pole(int a)
- {
- int kwadrat=a*a;
- return kwadrat;
- };
- };
- class prostokat:public figura
- {
- public:
- int a;
- int b;
- double pole(int a, int b)
- {
- int prostokat=a*b;
- return prostokat;
- };
- };
- class kolo:public figura
- {
- public:
- int r;
- double pole(int r)
- {
- double kolo=3.14*r*r;
- return kolo;
- };};
- class romb:public figura
- {
- public:
- int e;int f;
- double pole(int e, int f)
- {
- int romb=e*f;
- return romb;
- };};
- int main(int argc, char *argv[])
- {
- int a,b,r,e,f;
- kwadrat kwa1;
- prostokat pr1;
- kolo ko1;
- romb ro1;
- cout << "Kwadrat\n";
- cin >> a;
- cout << kwa1.pole(a);
- cout<<endl;
- cout << "Prostokat\n";
- cin >> a;
- cin >> b;
- cout << pr1.pole(a,b);
- cout << "\n";
- cout << "Kolo, podaj promien\n";
- cin >> r;
- cout << ko1.pole(r);
- cout << "\n";
- cout << "romb\n";
- cin >> e;
- cout << "\n";
- cin >> f;
- cout << ro1.pole(e,f);
- cout << "\n";
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement