本文整理汇总了C++中Pyramid::volume方法的典型用法代码示例。如果您正苦于以下问题:C++ Pyramid::volume方法的具体用法?C++ Pyramid::volume怎么用?C++ Pyramid::volume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pyramid
的用法示例。
在下文中一共展示了Pyramid::volume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
cout << fixed << showpoint << setprecision(2);
Cylinder one;
cout << "Enter cylinder height and radius >>> ";
cin >> one;
cout << "The cylinder volume is " << one.volume(one) << endl;
cout << "The cylinder surface area is " << one.surface_area(one) << endl;
cout << one;
Sphere two;
cout << "Enter sphere radius >>> ";
cin >> two.radius;
cout << "The sphere volume is " << two.volume(two) << endl;
cout << "The sphere surface area is " << two.surface_area(two) << endl;
cout << two.radius << endl;
Prism three;
cout << "Enter rectangular prism base length, height, and width >>> ";
cin >> three;
cout << "The rectangular prism volume is " << three.volume(three) << endl;
cout << "The rectangular prism surface area is " << three.surface_area (three) << endl;
cout << three;
Cone four;
cout << "Enter cone height and radius >>> ";
cin >> four;
cout << "The cone volume is " << four.volume(four) << endl;
cout << "The cone surface area is " << four.surface_area(four) << endl;
cout << four;
Pyramid five;
cout << "Enter pyramid base side length and height >>> ";
cin >> five;
cout << "The pyramid volume is " << five.volume(five) << endl;
cout << "The pyramid surface area is " << five.surface_area(five) << endl;
cout << five;
return 0;
}