I REALLY NEED HELP WITH THIS CODE!!! plz help!

This is a discussion on I REALLY NEED HELP WITH THIS CODE!!! plz help! within the C++ Programming forums, part of the General Programming Boards category; This is a problem from my computer science class... An approximate value of pi can be calculated using the series ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    1

    Exclamation I REALLY NEED HELP WITH THIS CODE!!! plz help!

    This is a problem from my computer science class...

    An approximate value of pi can be calculated using the series given below:

    pi = 4[ 1 - 1/3 + 1/5 - 1/7 + 1/9 ... + ((-1)^n) / (2n+1) ]

    Write a C++ program to calculate the approximate value of pi using this series. The program takes an input "n" that determines the number of terms in the approximation of the value of pi and outputs the approximation. Include a loop that allows the user to repeat this calculation for new values of "n" until the user says she or he wants to end the program.



    IF ANYONE COULD HELP ME WITH THE CODING, IT WOULD BE GREATLY APPRECIATED!!!!!

  2. #2
    Registered User
    Join Date
    Aug 2008
    Posts
    188

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I bet if you even bothered looking around you would see that Lucid already asked this question VERY recently. Plus at least Lucid speaks articulately and coherently. At least he also tries to write out some code too. You got a lot to learn buddy.

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    However, I suppose I could at least help you with the math portion. Though I bet I will get flamed even for doing that much...

    So you have your infinite series here, right? Why not try to put the series in its simplest terms. If you are going to be saying 4 * (... + ((-1)^n) / (2n+1) ) could you not just distribute the 4? Just a thought... It is also easier to program every little piece of information that you do know.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is wrong with my C code, PLZ help!!!
    By Eng_Girl in forum C Programming
    Replies: 5
    Last Post: 03-25-2006, 11:17 AM
  2. Replies: 1
    Last Post: 03-21-2006, 07:52 AM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  4. Replies: 9
    Last Post: 10-18-2004, 10:14 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM

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