Beispiel #1
1
int main() {
	
	
	// set the radius equal to -1 so we can ensure that
	// the user isgiving us valid input
	// what was the point of a constructor that has us
	// set radius=0? 
	double radius = -1;	

	// keeps asking for radius until positive radius is entered
	do {
		cout << "Please enter a radius: ";
		cin >> radius;
	} while (radius < 0);

	// create a pointer to an instance of a circle
	Circle * c = new Circle(radius);

	// output the area diameter, and circumference measurements
	cout << "The Area of your circle is: " << c->getArea() << endl;
	cout << "The Diameter of your circle is: " << c->getDiameter() << endl;
	cout << "The Circumference of your circle is: " << c->getCircumference() << endl;

	// free up the memory we used for c
	// How do we know if we should do this in the main or in the class?
	delete [] c;

	return 0;
}
Beispiel #2
0
void GerberGenerator::drawCircleOutline(const Circle& circle) noexcept {
  PositiveLength outerDia = circle.getDiameter() + circle.getLineWidth();
  Length         innerDia = circle.getDiameter() - circle.getLineWidth();
  if (innerDia < 0) innerDia = 0;
  flashCircle(circle.getCenter(), positiveToUnsigned(outerDia),
              UnsignedLength(innerDia));
}
Beispiel #3
0
int main() {
    Circle circle;
    double radius;
    cout<<"enter the circle's radius: ";
    cin>>radius;

    circle.setRadius(radius);

    cout<<"the circle's area is "<<circle.getArea()<<endl;
    cout<<"the circle's diameter is "<<circle.getDiameter()<<endl;
    cout<<"the circle's circumference is "<<circle.getCircumference()<<endl;

   return 0;
}
int main(int argc, char** argv) {
    float rad;
    Circle info;
    //input 
    cout<<"Input the radius"<<endl;
    cin>>rad;
    info.setRadius(rad);
    cout<<"Circle Information\n";
    cout<<"Area: "<<info.getArea(rad,PI)<<endl;
    cout<<"Diameter: "<<info.getDiameter(rad)<<endl;
    cout<<"Circumference: "<<info.getCircum(rad,PI)<<endl;
   
    return 0;
}
/*
 * The Circle main thread
 */
int main(int argc, char** argv) {

    double radius;
    
    cout << "Please enter the radius of a circle: ";
    cin >> radius;
    
    Circle* circle = new Circle(radius);
    
    cout << "The area of this circle is: " << circle->getArea() << endl;
    cout << "The diameter of this circle is: " << circle->getDiameter() << endl;
    cout << "The circumference of this circle is: " << circle->getCircumference() << endl;
    return 0;
}
Beispiel #6
0
void GerberGenerator::drawCircleArea(const Circle& circle) noexcept {
  flashCircle(circle.getCenter(), positiveToUnsigned(circle.getDiameter()),
              UnsignedLength(0));
}