Results 1 to 4 of 4
Like Tree1Thanks
  • 1 Post By ILikeSerena

Math Help - C++ programming. i urgently need help in this.plz help me!

  1. #1
    Junior Member
    Joined
    Feb 2013
    From
    Canada
    Posts
    31

    C++ programming. i urgently need help in this.plz help me!

    Write a C++ program that uses the following function that computes xn.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Apr 2005
    Posts
    15,792
    Thanks
    1532

    Re: C++ programming. i urgently need help in this.plz help me!

    That's very peculiar. Any caculator will do that easily and Windows includes a "virtual" calculator that will. So why do you need such a program?

    If this is for a class in C++ programming, I would think the point would be for you to write the program!

    I will tell you this much- for the actual calculation, and assuming that n is an integer, use a loop:
    \*************\
    func nthPower(real x; int n)
    int p= 1; \* initialize p*\
    for (int i= 0;i++;i< n) \* go through the loop n times*\
    \** what do you think goes here? **\
    return p;
    \*************\

    The fornat may not be exactly right. It has been a long time since I programmed in C++!

    (if n is not an integer you may want to use x^n= e^{nln(x)})
    Last edited by HallsofIvy; March 19th 2013 at 07:10 AM.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Super Member ILikeSerena's Avatar
    Joined
    Dec 2011
    Posts
    733
    Thanks
    121

    Re: C++ programming. i urgently need help in this.plz help me!

    Hi Riana!

    Something like this?

    Code:
    #include <cmath>
    #include <iostream>
    
    using namespace std;
    
    int main(void)
    {
        double x = 2.72;
        double n = 6;
        cout << pow(x, n) << endl;
        return 0;
    }
    Thanks from Riana
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Feb 2013
    From
    Canada
    Posts
    31

    Re: C++ programming. i urgently need help in this.plz help me!

    thankx everyone but later on i figured out
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Need Help Urgently...
    Posted in the Calculus Forum
    Replies: 1
    Last Post: May 25th 2009, 05:02 AM
  2. Replies: 1
    Last Post: November 17th 2008, 03:18 AM
  3. Help urgently!
    Posted in the Algebra Forum
    Replies: 2
    Last Post: August 19th 2008, 03:17 AM
  4. [SOLVED] Need Help Urgently
    Posted in the Algebra Forum
    Replies: 1
    Last Post: September 4th 2007, 05:03 AM
  5. Need help urgently
    Posted in the Discrete Math Forum
    Replies: 0
    Last Post: June 13th 2006, 09:04 PM

Search Tags


/mathhelpforum @mathhelpforum