[Solved] How to get out of this cycle?

Well, there’s always the break command. You can flag that after a key has been pushed, you want to break. And then outside the switch, you break. However, why do you need to have a while(true) loop anyway? solved How to get out of this cycle?

[Solved] Find the Shortest Cycle in Graph

If You’re looking for a complete answer, then just check other answers – there are tons of questions regarding used algorithms and I’ve also found an answer with code ported to many different programming languages (Cpp version is also there) Algorithm explanation C++ version I’d strongly recommend though, that You take a look at algorithms … Read more