please help me to write this program Ihave make one closed to it but I could not do it as what it says
here is the problem and my solution:
This is the program
Write a program that outputs a telephone bill, given information on telephone calls made by the user. A telephone call is described by:
- starting and stopping times, where the times are given in the form “hh:mm
- date “dd/mm/yyyy;
time cost / minute
00:00 - 07:59 0.10
08:00 - 16:59 0.15
17:00 - 23:59 0.12
The following table describes the cost of a phone call per minute.
• use pointer(s) to pass info to the BILL function;
• Try to use struct BILL;
the code:
#include <iostream.h>
int main()
{
long int units,charge=0;
float total;
const int rent=25;
cout << "Enter the number of units used : ";
cin>>units;
if(units>200)
charge=(units-200)*20+150*40+50*60;
else if(units>50)
charge=(units-50)*40+50*60;
else
charge=units*60;
total=0.01*charge+rent;
cout << "You have used " << units << " units." << endl;
cout << "Your total telephone bill is $" << total;
return 0;
}
<< moderator edit: added [code][/code] tags >>