C++程式設計練習——計算利息
阿新 • • 發佈:2018-12-13
#include<iostream> using namespace std; int main() { double intrest, total, min; int start, loan; cout << "如果你想要開始計算你的到期利息、總應付款和最小付款額,請輸入1\n"; cin >> start; while (start==1) { cout << "請輸入你的借貸金額:\n"; cin >> loan; if (loan <= 1000) intrest = loan*0.015; else intrest = 15 + (loan - 1000)*0.01; total = loan + intrest; if (total <= 10) min = total; else if (total <= 100) min = 10; else min = total*0.1; cout << "你的到期利息是:" << intrest << endl << "你的總應付款是:" << total << endl << "你的最小付款額是:" << min << endl; cout << "如果你想繼續計算,請輸入1\n"; cin >> start; } return 0; }