Example #1
0
string Circle::ToString() const {
    stringstream circleStream; // Start reading input into a stringstream
    // EDIT: Added the ToString() function of the Shape class to display the ID as well.
    circleStream << Shape::ToString() << ": Circle with Center at " << centre.ToString() << " and Radius = "
                 << radius << "\nCircumference: " << Circumference() << "\nArea: " << Area(); // Add string to circleStream
    return(circleStream.str()); // Output the string using the str() member function
}
Example #2
0
int main(int argc, char **argv)
{
  int w = 10;
  int h = 20;
  int circumFerence = Circumference(w, h);
  std::cout << "circumference = " << circumFerence << std::endl;
  return 0;
}
Example #3
0
		string Circle::ToString() const {
			stringstream circleStream; // Start reading input into a stringstream
			circleStream << "Circle with Center at " << centre.ToString() << " and Radius = "
				<< radius << "\nCircumference: " << Circumference() << "\nArea: " << Area(); // Add string to circleStream
			return(circleStream.str()); // Output the string using the str() member function
		}
Example #4
0
Double		poly2::CircumferenceRatio() const
{
	Double area = Area();
	return (area == 0 ? 0 : Circumference() / (2*sqrt(PI*area)));
}