Can you help me please

This is a discussion on Can you help me please within the C Programming forums, part of the General Programming Boards category; I do not know how to write power in C can you help me please Can write this function with ...

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    7

    Can you help me please

    I do not know how to write power in C can you help me please
    Can write this function with C please
    computeFlowRate(params, b, y)

    assign yb+y^2*params.z to area

    assign b+2y(1+params.z^2)^(1/2) to perimeter

    assign area/perimeter to rh

    assign (1/params.n) * area * rh^(2/3) * params.s^(1/2) to q

    return q

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,166
    Use the pow() function.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by Xbox999 View Post
    I do not know how to write power in C can you help me please
    Can write this function with C please
    Show us what you have tried and we can help you, otherwise see our Homework Policy.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  4. #4
    Registered User
    Join Date
    Nov 2009
    Posts
    7
    This is my try
    Code:
    double computeFlowRate(PARAM params, double b, double y)
    {
     double area,perimeter,rh,q;
    
     area = y*b+y pow(2)*params.z;
     perimeter = b+y*(1.0+params.z pow(2))pow (0.5);
     rh=area/perimeter;
    
     q = (1/params.n)*area*rh*2.0/3.0*params.s*0.5;
    
     return q;
    
    }

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    ok, if you want to take 2 to the power of 5, you would write pow(2.0 , 5.0).

    pow() Function

    so for yb+y^2*params.z I would write something like
    Code:
    area = y * b + pow(y , 2 * params.z);
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  6. #6
    Registered User
    Join Date
    Nov 2009
    Posts
    7
    Can you help me with the second one please I did not get it write
    this is my try
    [c]
    perimeter = b+2*y*(1.0+ pow(params.z,2)pow((params.z,2),1/2));
    [/c]

  7. #7
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by Xbox999 View Post
    Can you help me with the second one please I did not get it write
    this is my try
    [c]
    perimeter = b+2*y*(1.0+ pow(params.z,2)*pow((params.z,2),1/2));
    [/c]
    Is that what you mean?
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21