Using functions (subroutines)

I need to write a program to calculate time it takes (in increments of 10 seconds) to drain a tank of radius 2ft and height3ft

I have to use a function to get full credit

I am having major trouble, can anyone help?

Code:

#include <iostream>

#include <cstdlib>

#include <cmath>

using namespace std;

//Project 3 - Draining a Tank

//Name function for calculating volume lost

float calcVolLost(int height);

int main (void)

{

const double pi=3.14159;

float volume, VolumeLost, VelocityJet, DiaJet;

int time=0, height=3, RadiusTank=2;

//set flags for formatting

cout.setf(ios::left);

cout.setf(ios::adjustfield);

cout.setf(ios::showpoint);

cout.setf(ios::fixed);

cout.precision(3);

cout <<"Time"<<"Height of Fluid"<<"Velocity of Jet"<<"Diameter of Jet"<<endl;

//Subtract volume lost and calculate new height

while (height <=0){

float calcVolLost(int height);

volume=volume-VolumeLost;

height=height-(volume/(pi*RadiusTank*RadiusTank));

cout<<time<<height<<VelocityJet<<DiaJet<<endl;

}

return EXIT_SUCCESS;

}

//function for calculating volume lost

float calcVolLost(int height) {

i nt time;

const double pi=3.14159;

float c=0.95, float AreaJet, float DiaJet,float VelocityJet, float VolumeLost, float RadiusJet=0.1667;

AreaJet=pi*RadiusJet*RadiusJet;

VelocityJet=sqrt(2*32.2*height);

VolumeLost=10*VelocityJet*c*AreaJet;

time=time+10;

return VolumeLost;

}

:confused: See next reply which gives the problem...

returning values from functions

for some reason it is not returning the calculated values from my functions to the main program

Anyone know why?