Thread: applying formula help please

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    3

    applying formula help please

    How would you apply this formula to c++ program?
    t=2π√L/g

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What do you mean? You want to write it as a C statement?

    I'm going to give you an example of a math statement, not exactly the statement of what you are asking for, as that would be "solving the equation for you":
    Code:
    // Calculate the distance from 0,0 to x, y, using Pythagoras' method
    double distance(double x, double y)
    {
        double dist;
        dist = sqrt(x * x + y * y);
        return dist;
    }
    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    903
    What are you having trouble with ? What have you tried ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Zeller's Formula
    By unejam2005 in forum C++ Programming
    Replies: 6
    Last Post: 11-14-2005, 09:48 PM
  2. how to change char to formula
    By kosong in forum C Programming
    Replies: 2
    Last Post: 06-09-2003, 04:31 AM
  3. Math formula (js -->C++)
    By Demon1s in forum C++ Programming
    Replies: 20
    Last Post: 05-02-2003, 05:22 AM
  4. Need help with this formula -b/2a..Please read.
    By foofoo in forum C Programming
    Replies: 4
    Last Post: 06-04-2002, 11:59 PM
  5. Formula string conversion
    By Gr3g in forum C++ Programming
    Replies: 2
    Last Post: 04-12-2002, 08:28 PM