Question: Write a program in C++ please 4. The number of ways of arranging r objects chosen from n, where order is important (these are called

Write a program in C++ please

Write a program in C++ please 4. The number of ways of

4. The number of ways of arranging r objects chosen from n, where order is important (these are called permutations) is: perm(r, n) = n! (n-r)! Also, the number of ways of choosing r objects from n without regard to order (these are called combinations) is: comb(r, n) = n! (n - r)!r! Write three functions, fact(n) (= n!), perm(r, n), comb(r, n), and a main program to test them. The main prompts the user to enter the values of r and n then prints the values of r, n, perm(r, n) and comb(r, n) to an output file, permcombout.txt. The function perm() must call the function fact(). The function comb () must call both perm() and fact(). The input/output should look like: Enter r and n: 35 The number of permutations of 3 objects chosen from 5 is 60 The number of combinations of 3 objects chosen from 5 is 10 Run your program with r= 4 and n = 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!