C++编程练习——计算利息

#include
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;
}

你可能感兴趣的:(C++编程练习——计算利息)