如现在有以下环境
如苹果的价格为Price为Decimal
现在要你算出打XX(为int)折后的价格
开始我用Price * 0.01 * XX 但提示 Decimal 不能和 Double 进行算
所以没有办法用
Price * Convert.ToDecimal(XX) * Convert.ToDecimal(0.01)
感觉写的有点复杂
大家是怎么写的
------解决方案--------------------------------------------------------
你直接写
Price*XX/100
就可以
------解决方案--------------------------------------------------------
decimal price = 1000; Response.Write(price * 85 * (decimal)0.01);
------解决方案--------------------------------------------------------
Response.Write(price * 85 * (decimal)0.01);