尝试循环并乘以每个计数行的百分比

时间:2015-07-15 05:30:16

标签: c#

我无法弄清楚如何获得每日增加值并将其乘以每个新的计数行。我很确定我的错误是在数学中并试图设置计算输出到列表框中。

if (numDays >= 0)
{

    // Continue to process the input. /

    // The following loop calculates the final distance traveled. /
    while (count <= numDays)
    {
        // Calculate the organism population. /
        avgIncreaseDecimal = avgIncreaseInputValue / 100;
        percentageCalc = (organismsInputValue * avgIncreaseDecimal);
        nextPopulationCalc = organismsInputValue + (organismsInputValue * avgIncreaseDecimal);

        // Display the orgamism population for each day. /
        organismsCalcListBox.Items.Add("After day " + count + ", the organism population is approx. " + nextPopulationCalc.ToString("n6"));

        // Add one to the loop counter. /
        count = count + 1;

        // Return focus back to the organisms TextBox. /
        organismsInputTextBox.Focus();
    }
}

我已经在网上研究了其他的例子......但我仍然没有得到如何乘以30%并将其添加到每个新的计数行。

1 个答案:

答案 0 :(得分:0)

鉴于avgIncreadeInputValue的值是1-100(百分比),哦,祝你在学校其他学校运动中好运,你知道要求别人有点作弊;)

[01][0-9]