Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2004
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Max, Min, Average of Number String

    hey guys. i have several problems but i stuck with these 2 problems. hope you guys can help me out.

    1- write a C++ program that reads in an unspecified quantity of real numbers, of quantity < 100, and stops reading them in when the user inputs a character that you tell them to. The program then reports the exact quantity of numbers read in, their minimum, maximum, and average. Report at least 5 different runs of input sets. EX
    please enter numbers one at a time, pressing return after each one. when you want to stop, just enter 0 ( a zero)
    15.1
    176.6
    2066.4
    97.2
    0

    thank you.
    you entered 4 numbers
    the largest number is 2066.4, smallest is 15.1, the average is 58.825


    2- Pi Estimation with Arctan:
    Equation 1: pi/4 = 1-1/3 + 1/5 - 1/7 + 1/9 - ...
    which come from the series
    arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + x^9/9 - ... by letting x = 1.0
    however, rearranging the series produces a different looking equation:
    Equation 2: pi/8 = 1/(1x3) + 1/(5x7) + 1/(9x11) + ...
    which equation converges on a value of pi faster? write a c++ program that uses both equations 1 and 2, separately, showing how the value of pi changes as each term is added up to 50 terms. Identify which equation converges faster. write the output to an external file instead of to the screen.


    any help would be really helpful especially #2.
    thank you

  • #2
    New Coder
    Join Date
    Sep 2009
    Location
    Croatia
    Posts
    38
    Thanks
    3
    Thanked 5 Times in 5 Posts
    This looks like classic homework.

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Well what are you stuck on? What are your specific questions? What are you unsure about?
    OracleGuy

  • #4
    New Coder
    Join Date
    Sep 2004
    Location
    California
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i got it guys. thanks oracle

    how come i can't edit my original post?

  • #5
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by truviet911 View Post
    i got it guys. thanks oracle

    how come i can't edit my original post?
    Because it has been more than 2 days, why would you need to edit anyways? If you want to mark it resolved, it should still let you do that.
    OracleGuy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •