标签:style ar for strong on ef as line return
/// <summary>
/// 找零钱,返回人民币总张数
/// </summary>
class MoneyNums
{
/// <summary>
/// 定义人民币类别值
/// </summary>
private decimal[] RMB = { 100, 50, 20, 10, 5, 1, 0.5m, 0.1m };
/// <summary>
/// 找零钱,返回人民币总张数
/// </summary>
/// <param name="retval">找零总值</param>
/// <returns>返回张数</returns>
public int GetNums(decimal retval)
{
int Nums = 0;
if (retval > 0)
{
for (int i = 0; i < RMB.Length; i++)
{
while (retval >= RMB[i])
{
retval -= RMB[i];
Nums++;
Console.WriteLine(RMB[i]);
}
}
}
return Nums;
}
}
标签:style ar for strong on ef as line return
原文地址:http://www.cnblogs.com/shouwu/p/4112480.html