Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Help with assignment in C

  1. Jan 25, 2009 #1
    1. The problem statement, all variables and given/known data
    The assignment is to compute the motion of a pendulum in C. The relevant information is listed in this document: http://home.orange.nl/~kuip3148/pendulum.c [Broken]
    It says which values to use for the variables, the relevant equations and has the value of NSTEPS, DT and PRINTEVERY. I have a step by step guide to solving this problem as well in Mathematica:

    http://home.orange.nl/~kuip3148/Pendulum-assignment.nb [Broken]

    3. The attempt at a solution

    The first thing I need to do is make a loop that runs NSTEPS times. Given my total lack of C knowledge, I run into a problem straight away. How can I make such a loop?
     
    Last edited by a moderator: May 3, 2017
  2. jcsd
  3. Jan 25, 2009 #2
    I suggest you get a beginner's book to learning C to get the step by step basics. At the same time, you may want to install a c-compiler on your computer, such as Dev-C++, Borland, or Visual Studio express, they are all free and available from Bloodshed, Borland or Microsoft respectively.
    Here is the help you asked for, and hope that helps.

    int i;
    .... (define NSTEPS and other variables)

    for(i=0;i<NSTEPS;i++)
    {
    ... your code here
    }
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook