0

Need help with recursive function in c++

Recursive C++

18th Jun 2020, 5:11 PM
Derrick Nii Noi Nortey
Derrick Nii Noi Nortey - avatar
5 Réponses
+ 3
Please provide a code Here is a reference to recursive in cpp https://beginnersbook.com/2017/08/cpp-recursion/#:~:text=The%20process%20in%20which%20a,is%20called%20the%20recursive%20function.&text=Factorial%20function%3A%20f(n),f(n)%20%3D%201. please use searchbar and follow the 8 rules for getting help from the community. Thanks and happy coding. https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community
18th Jun 2020, 5:59 PM
BroFar
BroFar - avatar
+ 3
This doesn't sound like you need to use a recursive function, but a do-while loop. You can use a boolean that is set to false at the top of the loop before the switch and then if it is a number other than what is in your switch statement go into the default and set this boolean to true. This will cause it to loop until an appropriate value is entered. Ex. do { // pseudo get input x = input(); repeat = false; switch (x) { case 1: ... break; case 2: ... break; case 3: ... break; default: repeat = true; } while (repeat);
18th Jun 2020, 7:43 PM
ChaoticDawg
ChaoticDawg - avatar
0
What help you need. Can you explain?
18th Jun 2020, 5:19 PM
A͢J
A͢J - avatar
0
So I'm trying to creat a program for a Forex Bureau. Whereby I will use the switch statement .this code should be interactive and user friendly. I'm done with the program but this is the case, I want it to be in such a way that when the user enters a number other than that in my switch statement, the program will take the user back to the first line of code or even ask the user if he wants to quite and if yes the program ends
18th Jun 2020, 6:24 PM
Derrick Nii Noi Nortey
Derrick Nii Noi Nortey - avatar
0
I believe this will work
18th Jun 2020, 10:07 PM
Derrick Nii Noi Nortey
Derrick Nii Noi Nortey - avatar