cplusplus.com
C++ : Forum : Beginners : FUNCTIONS PLease help
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


post FUNCTIONS PLease help

vaflyboy03 (20)
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 (92)
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)
What should be there right value?
Grey Wolf (2846)
It doesn't matter, he is trying to return two seperate values from the function.
Topic archived. No new replies allowed.