0

Abnormal behaviour

Please look at the code where it prints "is not a prime number" (you must input non-prime number), it should print "Hello world" but does not. WHY? https://code.sololearn.com/cDjDHpzN7PjP/?ref=app

24th May 2019, 7:56 PM
Jakub Patrik
4 ответов
+ 1
i just put a <<endl before the semicolon of the statment and it got printed ... i don't even know cpp that much ... 😅 hope that helps, happy coding!!
24th May 2019, 10:14 PM
Anton Böhler
Anton Böhler - avatar
0
For some reason, the cout stream doesn't seem to be flushed, so you can either use << endl (as Anton Böhler pointed out) or << flush. Btw, the code says that 11 is not a prime number
24th May 2019, 11:04 PM
Anna
Anna - avatar
0
Sorry for the expression, but it is retarded. The compiler should be consistent and I believe that it should work without endl anyway. Thanks guys.
25th May 2019, 5:41 AM
Jakub Patrik
0
Either way, what's wrong with that while loop (h<=n)
25th May 2019, 6:00 AM
Jakub Patrik