Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <conio.h>
- #include <iostream>
- class Round
- {
- public:
- Round();
- ~Round();
- float GetArea();
- float GetLength();
- void SetRadius(float r);
- void SetCenter(float newx, float newy);
- private:
- float radius;
- float x, y;
- };
- Round::Round()
- {
- std::cout << "Enter x: ";
- std::cin >> x;
- std::cout << "Enter y: ";
- std::cin >> y;
- std::cout << "Enter raduis: ";
- std::cin >> radius;
- }
- Round::~Round()
- {
- }
- float Round::GetArea()
- {
- return 3.14 * pow(radius, 2.0);
- }
- float Round::GetLength()
- {
- return 2.0 * 3.14 * radius;
- }
- void Round::SetRadius(float r)
- {
- radius = r;
- }
- void Round::SetCenter(float newx, float newy)
- {
- x = newx;
- y = newy;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- Round *r = new Round;
- std::cout << r->GetLength() << std::endl;
- std::cout << sizeof(r) << std::endl;
- std::cout << sizeof(*r) << std::endl;
- delete r;
- std::cout << "Press any key to exit" << std::endl;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment