Closed Thread
Results 1 to 5 of 5

Thread: HELP! C# Output

  1. #1
    jclarke's Avatar
    jclarke is offline Programmer
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    104
    Rep Power
    15

    HELP! C# Output

    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).

    Code:
       // 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();
    EDIT: More Code to make it clear - My apologises

    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.

    Code:
    Enter a Number:
    (Person enters number here) 10
    
    (Answers reveals Below)
    Additon: 20
    Subtraction: 0
    Divide: 1
    Mulitply: 100
    Anyone who is a C# expert knows how to fix this problem? Your suggestions would be great!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest
    You overwrite the variable every time you do another math function:

    Code:
    output = fact.MultiplyNumber(userInput2);
    output = fact.SubtractNumber(userInput2);
    output = fact.DivideNumber(userInput2);
    You either need to define different variables or print immediately after you do a function.

    Code:
    outputMult = fact.MultiplyNumber(userInput2);
    outputSubt = fact.SubtractNumber(userInput2);
    outputDiv = fact.DivideNumber(userInput2);
    I've never seen this class Maths() and I couldn't find it on MSDN. Maybe I'm missing something?

  4. #3
    jclarke's Avatar
    jclarke is offline Programmer
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    104
    Rep Power
    15
    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?

  5. #4
    jclarke's Avatar
    jclarke is offline Programmer
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    104
    Rep Power
    15
    CORRECTION: In Correction of this code, It should use the 'binary coding' where it can show you the mathematical results. Problem Solved.

  6. #5
    jclarke's Avatar
    jclarke is offline Programmer
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    104
    Rep Power
    15
    Once I have the code fixed and working well, I will show you the code, and see what I mean.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to have this output?
    By Yuval in forum Assembly
    Replies: 1
    Last Post: 08-30-2011, 10:11 AM
  2. ocr - .xml-output
    By Marion in forum General Programming
    Replies: 1
    Last Post: 12-17-2009, 02:22 PM
  3. Help fix the output
    By 450081592 in forum Java Help
    Replies: 8
    Last Post: 11-20-2009, 10:51 PM
  4. how this output could be like this...
    By noteeth in forum C and C++
    Replies: 2
    Last Post: 11-01-2009, 05:36 AM
  5. Output rss
    By dirkfirst in forum PHP Development
    Replies: 4
    Last Post: 10-03-2006, 04:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts