double a, b, c, d; // 無意義單字母
int cout = 0; // 與 std::cout 衝突
while (cout <= year) {
c = c + c * b * cout; // 邏輯疑似錯誤:應為 c *= (1+b)
cout++;
}
inflationRate, annualExpense, years, budgetconst double PERCENT = 100.0;expense *= (1 + rate) 迭代 years 次double calculateBudget(double annualExpense, double inflationRate, int years) {
double expense = annualExpense;
for (int i = 0; i < years; ++i) {
expense *= (1 + inflationRate / 100.0);
}
return expense;
}
使用 IDE 重命名、SonarLint 靜態分析、ClangFormat 統一風格。