+ 4

C# Calculator History Function Help

Code: https://code.sololearn.com/cdrRBFMenx6B/#cs (only a section of the code I use for testing so only * works) I need help figuring out why my Class wont save the numbers inputted into it for later. If you have any suggestions or fixes please tell. This has been annoying me for hours. (Keep in mind this is a project I started when I was first introduced to C# Loops and have building on ever since, I just learned about classes and wanted to implement them so that's all I know in C#)

29th Mar 2018, 10:12 PM
Waffle HD
Waffle HD - avatar
2 ответов
+ 1
@Waffle HD It's great that you're building this project as you learn C#. I would suggest adding comments to your code, as you progress this will help you to remember what you were thinking about when you were coding last. Now onto the history function which by the way is doing exactly what you programmed it to do. The problem is that while Restart is true a new instance of Inputs will be assigned to the variable Multiplication, therefore, destroying the previous instance of Inputs and all of its data. This happens every time the user inputs y to restart. You can use the debugger in Visual Studio. Before tapping the F5 key, remember to place a break at the beginning of the while loop. The debugger will break at that point in the code and you can tap the F11 to step through the code. This will allow you see what going on as the app is running. I think this should point you in the right direction. If not forgive me.
30th Mar 2018, 12:47 AM
ODLNT
ODLNT - avatar
+ 1
I have gotten the answer from reddit all i had to do was move my Inputs up 2 lines above the while loop
30th Mar 2018, 12:49 AM
Waffle HD
Waffle HD - avatar