+ 2

What do I do to solve the bug ?

So You know that I posted My project Calculator v2.3 many time ago . And it contained a bug that when the user didn't have any input for num2 , it would be set to 4198464 by default . This is what I tried to fix it - if (num2 == 4198464) { num2 == 0; } So it didn't work . Now it is my request please help me to fix this . I will post the link to my project also . https://code.sololearn.com/cp547zh8Lm94/?ref=app

3rd Jan 2022, 8:45 AM
Pritam Santra
Pritam Santra - avatar
2 odpowiedzi
+ 4
Changed default value of second number from uninitialized to 1. When initialized to 0, it causes issues as you try and preform math operations with 0. But when initialized to 1, you have no need to enter the second number. https://code.sololearn.com/c9780O8q9nlI/?ref=app
3rd Jan 2022, 9:18 AM
Slick
Slick - avatar
+ 2
Slick thanks for the answer ! Now I can remove the bug note from there . Thanks !
3rd Jan 2022, 11:08 AM
Pritam Santra
Pritam Santra - avatar