|
// Define a BOX-like, tetragonal zygote, which requires its volume and surface area to be calculated.
#include <iostream.h>
class BOX
{public:
float x, y, z, v, b;
void Showv ()
{v = x * y * z;
cout << v << endl;};
void Showb ()
(b = 2 * (x * y + x * z + y * z);
cout << b << endl;};
};
void main ()
{BOX obj;
obj.x = 10; obj.y = 3; obj.z = 9;
cout << "The volume of this zygote is:";
obj.Showv ();
cout << "The surface area of the zygote is:";
obj.Showb ();
}
I also wrote a program, but I don't think the readability is very good, especially in the BOX class, which one can help me improve it ,,,, and, if you use #include <iostream> as the head File, it runs wrong, why? Thank you! |
|