As you may be aware that I am a learner of this lovely C# language, and it has kept me sitting on the edge of my office seat.... still curious and frustrated at times (Not to mention, that it happens all the time).
EDIT: More Code to make it clear - My apologisesCode:// Define a variable called output, and assign fact.AddNumber() int output = fact.AddNumber(userInput2); // Now add to the output variable output = fact.MultiplyNumber(userInput2); output = fact.SubtractNumber(userInput2); output = fact.DivideNumber(userInput2); string output2 = output.ToString(); Console.WriteLine("Your new number is: "+ output); Jake = new Maths(output2); Jake.Tell();
See the above code, this is the C# application I am experimenting at the moment, trying to get it right. Do you know how to make the output to work right, like if someone enters a number.. and the answers comes in 4 ways.. (mathematically) which would reveal the answers to the number a person entered (All revealed by the subtraction, divide, addition and mulitplying) but below is the example I want to see in the end result.
Anyone who is a C# expert knows how to fix this problem? Your suggestions would be great!Code:Enter a Number: (Person enters number here) 10 (Answers reveals Below) Additon: 20 Subtraction: 0 Divide: 1 Mulitply: 100![]()
You overwrite the variable every time you do another math function:
You either need to define different variables or print immediately after you do a function.Code:output = fact.MultiplyNumber(userInput2); output = fact.SubtractNumber(userInput2); output = fact.DivideNumber(userInput2);
I've never seen this class Maths() and I couldn't find it on MSDN. Maybe I'm missing something?Code:outputMult = fact.MultiplyNumber(userInput2); outputSubt = fact.SubtractNumber(userInput2); outputDiv = fact.DivideNumber(userInput2);
Jordan, Maths() is just a make up name I called for this experimenting project, but I don't know how to make this work in the Command prompt. Do you actually know what I mean?
CORRECTION: In Correction of this code, It should use the 'binary coding' where it can show you the mathematical results. Problem Solved.![]()
Once I have the code fixed and working well, I will show you the code, and see what I mean.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks