0
Need help with recursive function in c++
Recursive C++
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
+ 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);
0
What help you need. Can you explain?
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
0
I believe this will work