예제 #1
0
void PrintGeometricObject::PrintObject(Circle& c)
{
	// Todo
	cout << "Circle\n";
	cout << "  radius:        " << c.radius_ << " " << c.measurementUnit_ << "\n";
	cout << "  circumference: " << c.Circumference() << " " << c.measurementUnit_ << "\n";
	cout << "  area:          " << c.Area() << " " << c.measurementUnit_ << "^2\n\n";
}
예제 #2
0
파일: main.cpp 프로젝트: adde/circle
void calcArea()
{
	int radius = 0;

	cout << "Enter radius of the circle: " << endl;
	cin >> radius;

	Circle c = Circle((int)radius);

	cout << "The circle with a radius of " << radius << " has a area of " << c.Area() << endl << endl;
}
예제 #3
0
파일: main.c 프로젝트: lirui79/CProject
void test_three()
{
	Circle   *circle ;
	Point    *point ;
	Shape    *shape ;
	IMethod  *ptr ;
	double area = 0.0 ;
	circle = New(Circle) ;

	circle->Set(circle , 10.0 , 20.0) ;
	circle->Move(circle , 100.0 , 300.0) ;

	circle->Position(circle) ;

	circle->SetRadius(circle , 30.0) ;
	area = circle->Area(circle) ;

	circle->SetCircle(circle , 1.0 , 2.0 , 3.0) ;

	shape = (Shape*)circle ;
	shape->Position(shape) ;
	area = shape->Area(shape) ;

	point = (Point*)circle ;
	point->Move(point , 1000.0 , 2000.0) ;
	point->Position(point) ;

	circle->AddRadius(circle , 50.0) ;
	area = point->Area(point) ;

	ptr = (IMethod*)circle ;
//	area = ptr->Area() ;
    ptr->GetClassName() ;
	Delete(ptr) ;

}