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

📄 2.cpp

📁 经典C语言程序设计100例1-10 如【程序1】 题目:有1、2、3、4个数字
💻 CPP
字号:
/*---------------------------------------例题2-------------------------------------------------------------------*/

#include <iostream>

using namespace std;

int main()
{
	long double profit;	                                           //当月利润
	int i; 
	int bonus1, bonus2, bonus4, bonus6, bonus10;                   //奖金额度界限
	double bonus = 0;                                              //当月应获额度
	bonus1 = 100000 * 0.1; 
	bonus2 = bonus1 + 100000 * 0.075;
	bonus4 = bonus2 + 200000 * 0.05;
	bonus6 = bonus4 + 200000 * 0.03;
	bonus10 = bonus6 + 400000 * 0.015;
	cout<<"Please input the profit of this month:"<<endl;
	cin>>profit;
	i = profit /100000;                                           //为方便switch...case判断,对利润特进行处理
	switch(i)
	{
	case 0:
		bonus = profit * 0.1;break;
	case 1:
		bonus = bonus1 + (profit - 100000) * 0.075;break;
	case 2:case 3:
		bonus = bonus2 + (profit - 200000) * 0.05;break;
	case 4:case 5:
		bonus = bonus4 + (profit - 400000) * 0.03;break;
	case 6:case 7:case 8:case 9:
		bonus = bonus6 + (profit - 600000) * 0.015;break;
	default:
		bonus = bonus10 + (profit - 1000000) * 0.01;
	}
	cout<<"The bonus of this month is:   "<<bonus<<endl;

	return 0;
}

⌨️ 快捷键说明

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