A Cube is a geometrical three-dimensional shape formed by six equal square faces. It contains a total of 8 vertices and 12 similar size edges. If we consider the length of any one edge of the cube as a unit then the area of each face of the cube will be a^2. A Cube is a 3D object with length, breadth, and height the volume of a cube will be equal to length x breadth x height and as in our case, all sides are of equal length so the volume of our cube will be a^3.
Here in this post, we will find the volume of a cube with the help of C++ programming.
C++ Example Code:
//C++ Code Implementation for Volume of Cube #include<iostream> using namespace std; int main(){ int a, volume; cout<<"Calculate the volume of the Cube."<<endl; cout<<"Enter the length of the side of Cube: "; cin>>a; volume = a * a * a; cout<<"The Volume of Cube: "<<volume<<endl; return 0; }
Calculate the volume of the Cube. Enter the length of the side of Cube: 6 The volume of Cube: 216
No comments:
Post a Comment