Thread: A c program to evaluate the newtonian equations.

  1. #1
    Registered User
    Join Date
    Aug 2014
    Posts
    2

    A c program to evaluate the newtonian equations.

    I am stuck with a certain c programming code here,please help.
    Am supposed to write a c program capable of evaluating any of the three Newton's equations of motion.
    The program should ask which equation/law of the three he/she wants to evaluate.
    He/she should then be prompted for the inputs he/she has. The program should then output the result i.e the value of the missing variable in any possible situation.
    The output should be in SI units.
    The program should also be able to solve any of the possibilities given what the user inputs.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > capable of evaluating any of the three Newton's equations of motion.
    a) do you actually know what they are?

    b) are you able to solve them yourself on paper?

    c) given an input of x, could you solve y = x + 1 and print out the value of y?

    If you can do those three things, then you need to be posting YOUR attempt at the problem, rather than just dumping your assignment and expecting code on a plate.
    Announcements - C Programming
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Aug 2014
    Posts
    2
    #Salem
    U know i dont know what u think am trying to do here,what i need is a skeleton to help me feed my code not an assignement to be completed for me and for your info, i dont study programming in school,so i would apreciate it if u offered me assistance and not stuff i already know. As for your three queries am comfortable with them.
    Thank you.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by laurencemaina
    what i need is a skeleton to help me feed my code
    The "skeleton" has already been provided: it is the instructions that you have been given.

    Quote Originally Posted by laurencemaina
    i dont study programming in school,so i would apreciate it if u offered me assistance and not stuff i already know.
    So, this isn't a school assignment? It sounds like one. Salem did indeed offer you assistance; it so happens that you did not tell us that those stuff were stuff that you already know.

    Quote Originally Posted by laurencemaina
    As for your three queries am comfortable with them.
    That's good. So, pick one of the three equations and write a simplified version of the program in which the user is prompted for the input to the equation and then the program prints the output.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    If you are learning C for yourself to validate your working out in your Physics class, you are going to have to look at some tutorial/examples.

    For a learning series, there is a great one here C Tutorial - Learn C - Cprogramming.com

    As for some examples of "y=x+1" programs, I found some input/output here for you to look at Basic C Programs : C Programs A-Z - Basic C Programs | C Programming Examples

    I'd advise that you declare your main function like this though, as you want no arguments rather than an unspecified amount
    Code:
    int main(void)
    And of coarse, Newton's equations can be found on Wiki.
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Create a program that evaluate an equation?
    By tak13 in forum C Programming
    Replies: 1
    Last Post: 10-13-2011, 02:24 AM
  2. Replies: 8
    Last Post: 02-08-2011, 03:23 AM
  3. C++ Program to evaluate expressions
    By DMEngOba in forum C++ Programming
    Replies: 5
    Last Post: 05-25-2009, 09:16 PM
  4. Help! Program to evaluate expression...
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 02-19-2002, 06:20 AM
  5. Evaluate postfix expression program
    By shad0w in forum C Programming
    Replies: 1
    Last Post: 12-23-2001, 04:40 PM