⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 银行.txt

📁 类似于银行中计算的C++源代码。增长率
💻 TXT
字号:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <iomanip>
using std::setw;
using std::fixed;
using std::setprecision;

int main()
{
	int money;
	cout<<"Please input your money(>1000 and multiple)"<<endl;
	cin>>money;

	while (money%1000!=0)
	{
		cout<<money<<" is not multiple of 1000"<<endl;
		cout<<"Please input your money(>1000 and multiple)"<<endl;
		cin>>money;
	}
	cout<<"Please input everyday net value in this week:"<<endl;
	
	int counter;
	counter=1;
	
    double today;
	double yesterday;
    yesterday=1;
	today=1;
    double sum;
	sum=0;
     
	while (counter<=5)
    { 
		int Quotient;
     	double NetValue;
	    double IncreaseRate;
     	int CurrentValue;
	    int Currentpayoff;
		yesterday=today;
		cin>>today;
		counter=counter+1;
		sum=sum+today;
        if (counter==2)
            cout<<"Quotient      Net Value   Increase Rate   Current Value   Current payoff"<<endl;

		Quotient=money*(1-0.015)/1;
		NetValue=today;
		IncreaseRate=(today-yesterday)/yesterday*100;
		CurrentValue=today*Quotient;
		Currentpayoff=CurrentValue*(1-0.005)-money;
        
		cout<<fixed<<setw(8)<<Quotient<<" ";
		cout<<fixed<<setprecision(4)<<setw(14)<<NetValue<<" ";
		cout<<fixed<<setprecision(2)<<setw(14)<<IncreaseRate<<"% ";
		cout<<fixed<<setw(15)<<CurrentValue<<" ";
		cout<<fixed<<setw(16)<<Currentpayoff<<endl;
    }
	cout<<"Average Net Value in this week = "<<sum/5<<endl;
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -