This is the simple C++ program to calculate area and volume.
#include <iostream>
using namespace std;
int a_square(int length)
{
return length*length;
}
int v_cuboid(int length, int height)
{
return a_square(length)*height;
//return length*length *height;
}
void volume_cuboid()
{
int length,height;
cout<<"Enter the length of the cuboid: ";
cin>>length;
cout<<"Enter the height of the cuboid: ";
cin>>height;
cout<<"The volume of the cuboid is "<<v_cuboid(length,height);
}
void area_square()
{
int length;
cout<<"Enter the length of the square: ";
cin>>length;
cout<<"The area of th square is "<<a_square(length)<<endl;
}
int main()
{
area_square(); //functions declared
volume_cuboid();
}
Comments
Post a Comment