--Originally published at Solving Problems with Programming
Link of the picture: Link of the picture
So in this seven week class I started with doing the Computing for Social Good!!! and this WSQ06. Therefore, I started reviewing in creating and calling functions in C++. #Mastery06, #Mastery07, #Mastery16 Use of recursion for repetitive algorithms and #Mastery17 When to use what type of repetition in a program
What I did for this numeric program is solving the problem to the user by writing a program that asks the user for a non-negative integer (let’s call that number n) and display for them the value of n! (n factorial).
After showing them the answer, ask them if they would like to try another number (with a simple Y/N response) and either ask again (for Y) or quit the program and wish them a nice day (if they answered N).
Moreover, you need to have two basic approaches: a loop with an accumulator of the multiplication and a recursive solution. Choose one and implement that. Once that is done, try the other way.
If you used a while loop for the solution with a loop, try structuring this with a for loop (or vice-versa). Therefore, I am going to show you the 2 solutions in order to accomplish the the masteries regarding recursion. #Mastery16 and #Mastery17
The resources I need it to solve this program with the loop algorithm are here:
Similar code made by Xochitl96
The resources I need it to solve this program with the recursion solution and accomplish #Mastery16 Use of recursion for repetitive algorithms an #Mastery17 When to use what type of repetition in a program are here:
Similar code made by Gonzalomata22
The following photograph shows the solution to this problem:
Picture of author
So at first I wrote the same structure of the program just did the same as what
Continue reading "#WSQ06 Factorial Calculator 12/02/17 and WSQ06.cpp"