Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

proplem in c++

  • 28-03-2009 12:19pm
    #1
    Closed Accounts Posts: 1


    hi all i am studding c++ now and i have an assgiment to do pi calcution with the fourmila (pi = 4 *( (-1^n)/(2n+1))) now i know to do the power of with the () symbol in c++ the only proplem is the teacher told us not to use the <cmath> libry so if anyone got an answer or an idea to how to do it thank you so much for the help :) it been 3 days now and i am still trying :confused:


Comments

  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    Emmmm this is pretty simple maths - x^3 = x*x*x - so x^n is x multiplied by itself n times. Write a little function to perform the power function and feed it the value of x (in this case -1) and n (however many times you want to run the function) and get it to return the result.

    Without trying to be cruel, if you're having issues with problems as simple as this one, perhaps programming is not for you.

    -RD


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    when you want to do something over and over in programming use a loop.

    show us an attempt and people will be a lot more willing to help


  • Registered Users, Registered Users 2 Posts: 5,161 ✭✭✭10000maniacs



    Without trying to be cruel, if you're having issues with problems as simple as this one, perhaps programming is not for you.

    -RD

    Thats what these forums are all about. Sensitive criticism:rolleyes:,Useful help:rolleyes: and career advice:rolleyes: all in the same post.

    Maybe he was looking for something like this.
    http://www.boo.net/~jasonp/pipage.html


Advertisement