编写程序以按照以下规则计算每月电话账单:
您必须接受来自用户的呼叫数,并根据以下规则计算每月账单。
Minimum Rs. 200 for upto 100 calls.
Plus Rs. 0.60 per call for next 50 calls.
Plus Rs. 0.50 per call for next 50 calls.
Plus Rs. 0.40 per call for any call beyond 200 calls.
#include <iostream>
using namespace std;
int main()
{
int x;
float fee;
cin >> x;
if (x <= 100)
{
fee = 200.0;
}
else if (x <= 150)
{
fee = 200.0 + (x - 100)*0.6;
}
else if (x <= 200)
{
fee = 230.0 + (x - 150) * 0.5;
}
else
{
fee = 255.0 + (x - 200) * 0.4;
}
cout << fee;
}
return 0;