Problem

The number of permutations of a set of n items taken r at a time is given by the followi...

The number of permutations of a set of n items taken r at a time is given by the following formula:

where n! is the factorial of n. (See Programming Problem 3 for a discussion of ways to compute the factorial.) If there are 18 people in your class and you want to divide the class into programming teams of 3 members, you can compute the number of different teams that can be arranged using this formula. Write a C++ program that determines the number of potential team arrangements. You will need to use the double type for this computation. Be sure to use proper formatting and appropriate comments in your code. The output should be labeled clearly and formatted neatly.

REF PRB:

The factorial of a number n (written n!) is the number times the factorial of itself minus one. This self-referential definition is easiest to understand through an example: The factorial of 2 is 2 * 1; the factorial of 3 is 3 * 2 * 1; the factorial of 4 is 4 * 3 * 2 * 1; and so on. Factorials grow very large, very quickly. An approximation to the factorial for larger values is given by Stirling’s formula:

The exp function in the <cmath> header file gives the value of e raised to given power (see Appendix C.5). We’ve already discussed all of the other functions that are needed to write this formula. Write a C++ program that computes the factorial of 15 both directly and with Stirling’s formula, and outputs both results, together with their difference. You will need to use the double type for this computation. Be sure to use proper formatting and appropriate comments in your code. The output should be labeled clearly and formatted neatly.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT