post  FUNCTIONS PLease help

vaflyboy03 (19)   Link to this post
Hi im having trouble getting the function to return the right values for i and q... heres my code

# include <iostream>
# include <cmath>
# include <iomanip>
# include <fstream>
using namespace std;
double flow_rate (double,double,double,double);
int main ()
{
double Q,k,i,H,L,A,D,D1;
D = 10; L = 200; k = 0.1; H = 50;

cout<<"All raw data D= "<<D<<"L= "<<L<<"k= "<<k<<"H= "<<H<<endl;
cout<<"Calculated values of i= "<<i<<endl;
cout<<"Flowrate Q= "<<Q<<endl;







system("pause");
return 0;
}
double flow_rate (double D,double L,double k,double H)
{
double Q,i,A,D1;
D = 10; L = 200; k = 0.1; H = 50;

D1 = (.3937)*(D);
i = (H / L);
return i;
A = (.785)*((D)*(D));

Q = (k)*(i)*(A);
return Q;



}
magicalblender (82)   Link to this post
It looks like you don't have a very good understanding of functions yet. I suggest you read this page:
http://www.cplusplus.com/doc/tutorial/functions.html
SteakRider (110)   Link to this post
What should be there right value?
Grey Wolf (1407)   Link to this post
It doesn't matter, he is trying to return two seperate values from the function.

This topic is archived - New replies not allowed.