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";
}