CPP Cafe

The Menu

 

Home -> Menu ->Long Distance

output

Long Distance

#include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;
//tells how much a long distance phone call is

const double con = 1.99;
const double three = 2.00;

int main()
{
int min;
double num;
double left;
double sum;

cout<<fixed<<showpoint<<setprecision(2);
cout<<"An international call from New York to Paris is"
<<"$1.99 connection fee, $2.00 for the first three minutes"
<<"and $.45 for each additional minute."<<endl;
cout<<"Please enter how many minutes:"<<endl;
cin>>min;

if(min == 3){
num = con + three;
cout<<"You owe $"<<" "<<num;}
else{
cout<<"You have longer than three minutes."<<endl;}

if(min > 3)
left = min - 3;
sum = (left * .45) + con + three;
cout<<"You owe this amount $"<<" "<<sum<<endl;

//system("PAUSE");
return 0;
}