Problem with saving inputs properly! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

27th Jan 2023, 2:03 AM
Murtaja Ali
2 Answers
+ 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
27th Jan 2023, 3:45 AM
Scott D
Scott D - avatar
27th Jan 2023, 3:56 AM
Scott D
Scott D - avatar