题目:
文章来源:https://www.toymoban.com/news/detail-788937.html
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
unsigned int account;
double beginning_balance, total_charges, total_credits, credit_limit;
cout << "Enter account numbeu(or -1 to qiut):";
cin >> account; // 输入账户
while (account != -1)
{
cout << "Enter beginning balance:";
cin >> beginning_balance; // 月初欠款
cout << "Enter total charges:";
cin >> total_charges; // 输入本月购买的所有商品的总金额
cout << "Enter total credits:";
cin >> total_credits; // 本月顾客账户存入的总金额
cout << "Enter credit limit:";
cin >> credit_limit; // 允许的信用额度
double newBalance;
newBalance = beginning_balance + total_charges - total_credits;
cout<<setprecision(2)<<fixed;
cout<<"New balance is "<<newBalance<<endl;
cout<<"Account:\t"<<account<<"\nCredit limit:\t"<<credit_limit
<<"\nBalance:\t"<<newBalance<<endl;
if (newBalance > credit_limit)
{
cout << "Credit Limit Exceeded." << endl;
}
else
{
cout << endl;
}
cout<<"\n";
cout << "Enter account numbeu(or -1 to qiut):";
cin >> account; // 输入账户
}
return 0;
}
文章来源地址https://www.toymoban.com/news/detail-788937.html
到了这里,关于《C++大学教程》4.14信用额度问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!