コード例 #1
0
ファイル: Circle.cpp プロジェクト: mistletoe999/cpp-samples
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
}
コード例 #2
0
ファイル: main.cpp プロジェクト: Chhabi/cppexamples
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;
}
コード例 #3
0
ファイル: Circle.cpp プロジェクト: mistletoe999/cpp-samples
		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
		}
コード例 #4
0
ファイル: poly2.cpp プロジェクト: NREL/EnergyPlusRelease
Double		poly2::CircumferenceRatio() const
{
	Double area = Area();
	return (area == 0 ? 0 : Circumference() / (2*sqrt(PI*area)));
}