+ 6

Need a help to find errors...?

I want help to debug the code my code working infinite times. https://code.sololearn.com/cnyL7hrlgAPD/?ref=app

15th Sep 2020, 3:34 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
5 Answers
+ 2
Why you did not code your menu choices outside while loop?Why you did not set a condition for while: int tries =1; int count = 0; While(count < triea){ā€¦}
15th Sep 2020, 3:51 PM
HBhZ_C
HBhZ_C - avatar
+ 2
While: Int tries =1; Ing count =0; While(count< triea){...}
8th Oct 2020, 7:29 PM
Abdirashid Hassan Aidid
Abdirashid Hassan Aidid - avatar
+ 1
15th Sep 2020, 5:33 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Your outer loop has no exit condition.. Add like this 1) cin >> menuChoice; if( menu Choice == 'Q') break; 2) And instead of else if (subMenuChoice == 'N' || subMenuChoice == 'n') { break; } Just add else { break;}
15th Sep 2020, 5:29 PM
Jayakrishna šŸ‡®šŸ‡³
0
Where? Which one not getting?šŸJasprit šŸ—”ļø Your 1st statement in main while(true) {..} has no stop condition so it 8s infinite loop... So add a break statement upon a condition like a example i given above.. And in case=>while statements =>if you want to continue, take input 'y' and for any other input use break condition.. Otherwise you have much y or n absolutely so any other input also cause to continue.. So if you want to continue until enter n, then write alternatively if(subMenuChoice =='N' || subMenuChoice =='n') break;
15th Sep 2020, 5:41 PM
Jayakrishna šŸ‡®šŸ‡³