While loop problem maybe? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

While loop problem maybe?

In main() theres a while(true), and in the end theres break; also an if(!logout) then will not break the loop, the problem is when i run this code in OnlineGDB, it just display nothing and done with code 0, please help me 👍 https://sololearn.com/compiler-playground/cdy8kC8MCSls/?ref=app

28th Apr 2024, 1:13 PM
LemonKitana
LemonKitana - avatar
3 Answers
+ 2
Sorry, I'm not really across c++, but maybe changing your login variable to a boolean True/False instead of a 0 could help. If the 0 and 1 already are that, maybe you need to check your break conditions in another way.
28th Apr 2024, 2:43 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
you guessed right, its the infinite loop. Why not use a multithread?
28th Apr 2024, 8:09 PM
White Shadow
White Shadow - avatar
0
Alright, thanks man for answering my question
29th Apr 2024, 2:28 PM
LemonKitana
LemonKitana - avatar