How to use Multiplication operator in Asp.net?

Discussion in 'ASP.NET / ASP.NET Core' started by yawowcom001, May 19, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Thanks, yzarc

    Even though I have changed variable declaration into "decimal", but in Internet Explorer, there is still error messge showing out:

    The "*" can not using in Decimal or Double operation.
     
  2. When I used the line in Asp.net, it doesn't work. I have been trid use "decimal operator *(decimal x, decimal y)" to solve the problem, but it still confused me.

    Please give to an example on that, thanks.

    int vat = (myCart.TotalCost(cartId) + 10) * 0.175;
     
  3. I believe the problem is in your variable declaration.
    multiplying by .175 will result in a decimal value, but you are assigning it to an int, without any type of conversion routine.

    Greg

    quote:Originally posted by yawowcom001

    When I used the line in Asp.net, it doesn't work. I have been trid use "decimal operator *(decimal x, decimal y)" to solve the problem, but it still confused me.

    Please give to an example on that, thanks.

    int vat = (myCart.TotalCost(cartId) + 10) * 0.175;
    </blockquote id="quote"></font id="quote">

    Greg Kelley
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page