So the teacher told me to combine the two functions from the first code and i tried but it wont give me the correct answers. I cant seem to find the problem on it..

I cant seem to call the function on the second code.. thanks in advance.

#include <iostream>
using namespace std;

//////FIRST CODE///////////
float poolsize(float length, float width, float depth); //function for volume.

float capacity(float volume, float cubicfoot); //function for capacity in gallons.


void main ()
{ 
	const float cubicfoot =7.48051948;
	float length;
	float width;
	float depth;
	float volume;
	float gallons;

	cout << "Insert the length: ";
	cin >> length;
	cout << "Insert the width: ";
	cin >> width;
	cout << "Insert the depth: ";
	cin >> depth;

	volume = poolsize(length, width, depth);
	cout << "The volume of the pool is: "<< volume << "\n\n";

	gallons = capacity(volume, cubicfoot);
	cout << "The capacity in gallons for this pool is: " <<gallons <<"\n\n";


	system("pause");
}

float poolsize(float length, float width, float depth)
{
	return length*width*depth;
}

float capacity(float volume, float cubicfoot)
{
	return volume*cubicfoot;\
}
#include <iostream>
using namespace std;

//////SECOND CODE////////

float PoolSize(float Length, float Width, float Depth, float volume, const float cubicfeet=7.48051948);

void main ()
{ 
	
	
	PoolSize(float Length, float Width, float Depth, float volume, const float cubicfeet=7.48051948);

	

	system("pause");
}


float PoolSize(float Length, float Width, float Depth, float volume, const float cubicfeet=7.48051948)
{
	float length;
	float width;
	float depth;
	float gallons;

	cout << "Insert the length: ";
	cin >> length;
	cout << "Insert the width: ";
	cin >> width;
	cout << "Insert the depth: ";
	cin >> depth;

	volume = (length*width*depth);
	cout << "The volume of the pool is: "<< volume << "\n\n";

	gallons = (volume*cubicfeet);
	cout << "The capacity in gallons for this pool is: " <<gallons <<"\n\n";
}

I'm talking here just about your second program.

PoolSize(float Length, float Width, float Depth, float volume, const float cubicfeet=7.48051948);

This is not how you call a function. You don't specify what kind of object they are when you call it. Just the name. Try

PoolSize( Length,  Width,  Depth,  volume,  cubicfeet);

The next problem is that when you call the function, you haven't defined Length or Width or Depth or volume or cubicfeet. You need to create these objects first if you're going to try to use them. However, given that the first thing you do inside the function is then create these variables and get values for them, why are you trying to pass them into the function? I think you've got very confused over how to call a function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.