Horners method - c program, Public Economics

Horners method -  C program:

Modify the program to implement the details for the recursive function called horners(double b, int n) that calculates Horner's method for a coefficient of 1 and a given value of b and for integer n. Horner's method for this problem is define as 1 + b * (1 + b * (1 + b * ( 1 + . . . + b))).

#include

#include

#include

#include

using namespace std;

double horners(double b, int n);

int main(int argc, char **argv)

{

             cout << "horners(2, 4)  = " << horners(2, 4) << endl;

             cout << "horners(3, 2)  = " << horners(3, 2) << endl;

             cout << "horners(5, 5)  = " << horners(5, 5) << endl;

             cout << "horners(10, 3) = " << horners(10, 3) << endl;

             cout << "horners(13, 2) = " << horners(13, 2) << endl;

             cout << endl << "Press any key to continue." << endl;

            getchar();

   return 0;

}

double horners(double b, int n)

{

   //     using recursive definition

  //       1 + b * (1 + b * (1 + b * ( 1 + . . . + b)));   

    return 0.0;

}

/*

Output will be

horners(2, 4) = 31

horners(3, 2) = 13

horners(5, 5) = 3906

horners(10, 3) = 1111

horners(13, 2) = 183

Posted Date: 2/11/2013 5:46:17 AM | Location : United States







Related Discussions:- Horners method - c program, Assignment Help, Ask Question on Horners method - c program, Get Answer, Expert's Help, Horners method - c program Discussions

Write discussion on Horners method - c program
Your posts are moderated
Related Questions
Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

QUESTION a) How would the strategy of a firm faced with repeated games differ from that faced with sequential games? b) What do you understand by an optimal level of poll

Related Goods Approaches - Indirect Substitute Approach Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInter

Assignment This assignment will provide you with insight on how others perceive you. It will be particularly useful in situations in which you find differences in self-other resul

Discuss whether high indirect taxes are the best way to discourage smoking.

(1) The federal government is considering selling tracts of federally owned land to private developers and using the revenues to provide aid to victims of an earthquake in a foreig

What makes a public opinion poll scientific 1. To what extent do we really think about political issues as individuals, or are we more influenced by our environment -family, t

how wage increase of fixed income groups'' will affect the overall economy? what are effects exactly?

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

various credit arrangements