Can you help me with this question

1. Having the following function headings:

void GetValues(int &length, int &width, int &depth);
void CalcCubic(int length, int width, int depth, int &cubic);
void PrintCubic(int cubic);

Write a C++ program that asks the user to enter the length, width,
and depth of a swimming pool using GetValues( ). Calculate the
cubic volume using CalcCubic( ). Print the result using
PrintCubic( ). Add the function BaseArea( ) that returns the area
of the swimming pool base.

And this is my answer ::

Plezzzz Help Me !!!

#include <iostream.h>
#include <math.h>
void GetValues (int &length, int &width, int &depth)
{
	cin>>length>>width>>depth;
}
void CalcCubic(int length, int width, int depth, int &cubic)
{
	
	int volume=length*width*depth;
	cubic=volume*volume*volume;
}
void PrintCubic (int cubic)
{
	
	cout<<cubic;
}

int BaseArea (int area,int length, int width, int depth)
{
	area=(2*length*width)+(2*length*depth)+(2*width*depth);
	return area;
}


int main ()
{
	int x,y,z,h,i;
	cout<<"Enter the (length & width & depth ) of the swimming pool: ";
	GetValues (x,y,z);
	CalcCubic(x,y,z,h);
	cout<<"\nThe cubic volume of the swimming pool= ";
	PrintCubic (h);
	cout<<endl;
	cout<<"\nThe area of the swimming pool= ";
	cout<<BaseArea (i,x,y,z);
	cout<<endl;
	return 0;
}

You havent explained your problem. I can see a few errors just by looking at it.

  • BaseArea (i,x,y,z); i hasnt been assigned a value yet
  • Change <iostream.h> to <iostream>
  • Your using std events but you fergot to add using namespace std; at the beginning of the code

<iostream.h> was declared deprecated

This article has been dead for over six months. Start a new discussion instead.