It really wasn’t my intention to offend you. I’ll try to make better answers in the future. But all that I said, I said to make you a better developer.
Your code really is “uglier, bigger, slower and unnecessary” compared to the lesson code. Knowing that now is gonna be good for your own development. Nobody is born knowing everything and is useful to be open to learn new things. As you keep coding and read good code from other people you’re going to enhance your skills.
I thought what I wrote was enough to clear out what was not good about it. The thing is: In this case you just want to get a simple answer from the user and give him a easy way to do this. The solution you came up with uses tools that are not necessary for the task. It is just making the code slower (because of things like the switch statement and the while loop) and bigger, the original solution uses only 4 lines of simple code that takes two seconds for reading, your code has several lines.
This is called recursion, a recursive function is a function that calls itself. It can be very useful. But it isn’t always wanted since every call uses up hardware resources. For example, calculating the fibonnaci sequence with a recursive function is bad because the number of calls grows exponentially (in this specific case!) using a lot more of CPU, RAM than an iterative solution. So be careful on when to use it.
The thing is: It is ok if your code isn’t very good in the beginning, if you keep trying to learn and evolve you’re gonna get better over time.
When you have the time (after finishing this course), read Clean Code and Code complete. And if you’re planning in becomming a real pro C++ developer also look for The C++ Programming Language book (it’s written by the creator of C++ himself).
By the way, I’m not saying for you to take all I say as the absolute truth. I’m just learning as well. But what I said was intended to help you.
I hope you’re advancing in the course and that this answer was useful. Consider my book recomendations. If you need to learn how to model 3D objects watch this guy’s videos. They are quite useful, he knows a lot about Blender. Unreal also has an YouTube channel, look for it and remember you can read the engine documentation to clear any doubts and enlarge your knowlegde about it.
Don’t give up nor let this episode discourage you, bye.