0
Problem with saving inputs properly!
Hey brothers and sisters.. I have a problem here with my code but I canât find it. If anyone could help me, I will appreciate it very much. The codeâs idea is to convert between units as the user want, but the problem Iâm facing is whatever the number the user puts, it get saved as whole another and kinda weird number that is not even close to the userâs number. I couldnât figure out the issue, so Iâm looking for your help thankfully đđ». https://code.sololearn.com/cEt0kgZi985a/?ref=app
2 RĂ©ponses
+ 3
ï»żMurtaja Ali
The error is not how the number entered is being saved. See attached example. It shows the entered num is being correctly interpreted and put into memory.
The error is that for some reason you are attempting to use case 1 as the method of getting the number which has no logic. The code is rather confusing. And I don't understand the while loop, maybe I'm missing something in your intent.
You have 4 void functions, you only need 4 cases. You also need to modify the main code to pass the input number variable to the functions as a parameter when calling them, as well as modifying the functions to accept that parameter.
See lesson 37.1
https://code.sololearn.com/cC9ap0sk5Pf2/?ref=app
+ 1
Murtaja Ali
Here's an example.
https://code.sololearn.com/c6l1jKHDo23T/?ref=app