小编Pra*_*del的帖子

C#中的列表或字典

我需要两个列表作为输出,其中一个是索引列表,另一个是相应的值,直到条件满足为止.

//initializing the first value of TotalDebts
double TotalDebts = 30000;
for (int i = 0; i < 250; i++)
{
    if (TotalDebts > 0)
    {
        double DebtsLessIncome = Convert.ToDouble(TotalDebts - 1000);
        double InterestCharged = Convert.ToDouble((DebtsLessIncome * 5) / 100);
        double InterestDebt = Convert.ToDouble(DebtsLessIncome + InterestCharged);
        double InterestDebtMLE = Convert.ToDouble(InterestDebt + 500);
        double TotalDebts = Convert.ToDouble(InterestDebtMLE);
        //how to add TotalDebts in list or dictionary from each loop as index 0,1,2 and so on 
        List<double> AllDebits = new List<double>();
        AllDebits.Add(TotalDebts);
        // …
Run Code Online (Sandbox Code Playgroud)

c#

-7
推荐指数
1
解决办法
119
查看次数

标签 统计

c# ×1