本文整理汇总了C++中Polyhedron::setSide4方法的典型用法代码示例。如果您正苦于以下问题:C++ Polyhedron::setSide4方法的具体用法?C++ Polyhedron::setSide4怎么用?C++ Polyhedron::setSide4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyhedron
的用法示例。
在下文中一共展示了Polyhedron::setSide4方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Polyhedron polyhedron; // new polyhedron object
float side;
float height;
// Q5 : 10 points
// Convert all C input/output (printf/scanf) to C++ input/output (cin/cout) in this main method.
// (this includes the 3 C output (printf) used near the end of the main method.)
// Your C++ input/output must be equivalent to the given C input/output.
cout << "Enter the sides of the base of the polhedron:" << endl;
cout << "If the polhedron is triangular, please enter 0 for any given side." << endl;
cout << "Side 1: ";
cin >> side;
polyhedron.setSide1(side);
cout << endl;
cout << "Side 2: ";
cin >> side;
polyhedron.setSide2(side);
cout << endl;
cout << "Side 3: ";
cin >> side;
polyhedron.setSide3(side);
cout << endl;
cout << "Side 4: ";
cin >> side;
polyhedron.setSide4(side);
cout << endl;
cout << "Height: ";
cin >> height;
polyhedron.setHeight(height);
cout << endl;
Shape temp = polyhedron.TypeChecker();
string shape;
switch (temp)
{
case Triangular:
shape = "Triangular Polyhedron";
break;
case Square:
shape = "Square Polyhedron";
break;
default:
shape = "Rectangular Polyhedron";
break;
}
float baseArea = polyhedron.BaseArea();
float pyramidVolume = polyhedron.PyramidVolume(baseArea);
float prismVolume = polyhedron.PrismVolume(baseArea);
cout << "This is a " << shape << "." << endl;
cout << "The volume of this pyramid is: " << pyramidVolume << endl;
cout << "The volume of this prism is: " << prismVolume << endl;
return 0;
}