Wrox Programmer Forums
|
BOOK: Beginning Visual C#
This is the forum to discuss the Wrox book Beginning Visual C#, Revised Edition of Beginning C# for .NET v1.0 by Karli Watson, David Espinosa, Zach Greenvoss, Jacob Hammer Pedersen, Christian Nagel, Jon D. Reid, Matthew Reynolds, Morgan Skinner, Eric White; ISBN: 9780764543821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 8th, 2004, 12:46 PM
Registered User
 
Join Date: Feb 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rf5976
Default HELP... >"<

I feel I am so stupid. I don't know what wrong in my programe code. I know I make a very silly mistake. Can you help me to make this programe running? Thank you very much!
---------------------------------------------------------------------

using System;

namespace Math
{
    class MathTest
    {
        public double add(double num1, double num2)
        {
             return (num1 + num2);
        }
        public double sub(double num1, double num2)
        {
            return (num1 - num2);
        }
        public double mul(double num1, double num2)
        {
            return (num1 * num2);
        }
        public double div(double num1, double num2)
        {
            return (num1 - num2);
        }
        static void Main(string[] args)
        {
            double firstNumber, secondNumber;
            Console.WriteLine("Please input your first number: ");
            firstNumber = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Please input your second number: ");
            secondNumber = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("{0} + {1} = {2}", firstNumber, secondNumber, add(firstNumber, secondNumber));
            Console.WriteLine("{0} - {1} = {2}", firstNumber, secondNumber, sub(firstNumber, secondNumber));
            Console.WriteLine("{0} * {1} = {2}", firstNumber, secondNumber, mul(firstNumber, secondNumber));
            Console.WriteLine("{0} / {1} = {2}", firstNumber, secondNumber, div(firstNumber, secondNumber));
        }
    }
}
 
Old April 9th, 2004, 04:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Looks like your div() function doesn't divide numbers, it subtracts them.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:37 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
<STRONG> vs <B> and <EM> vs <I> anshul HTML Code Clinic 12 September 1st, 2004 05:22 PM
a problem in book<<beginning asp.net using vb>> luoware ASP.NET 1.0 and 1.1 Basics 3 December 8th, 2003 09:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.