function cal({init, years, rate, money, totalYears}){
let total = init;
let count = 1;
while(count<=years){
let inMoney = money * 12;
let outMoney = (total+ inMoney) * rate;
total = total + inMoney + outMoney;
console.log(`定投第${count}年: ${total}`);
count++;
}
while(count<=totalYears){
total = total * (1+rate)
console.log(`复利第${count}年: ${total}`);
count++
}
console.log(`总投入: ${init + years * money * 12}`)
console.log(`总收入: ${total}`)
console.log(`收入/投入: ${total/(init+years* money * 12)}`)
return total;
}