OK I am making a calculator pretty much similar to the windows calculator. It uses buttons 0-9 and +, -, *, /, Clr buttons. In writing a class that would look something like:
Code:
public class MathFunctions
{
public int Add(int a, int b)
{
return(a + b);
}
When the user clicks say 23 then + then 23, how do i handle the variables such that the function in my class will be called and add a + b (or in this case, 23 + 23) and returned to my textbox? I am not handling the strings in a "23+23" fashion...it is set up so that when the user clicks the plus the 23 is stored, and the textbox cleared for the next number...i am having problems with where to execute the code that calls my class and function...additionally, how would it be handled such that the total would be stored so that upon adding the next number, 46 would be my "a" variable.... Hope this isn't confusing...I know with addition I could do this easier but I am just trying something simple so that i have an understanding of how to handle the class so I can eventually use more complicated functions////
Seymour