A customer pays a monthly fee of $37.50 for the telephone service and $3.50 per minute for long distance calls. Input the number of minutes for long distance calls. Calculate the total bill. Print the results and ask again. The only way to exit the program would be for number of minutes is -1. (while loop structure)
#include <iostream>
using namespace std;
int main(){
float totalBill=37.50;
float minute =0;
while(minute!=-1){
cout<<"Enter minutes (-1 exit): ";
cin>>minute;
if(minute!=-1){
totalBill+=3.50*minute;
cout<<"The total bill: $"<<totalBill<<"\n\n";
}
}
system("pause");
return 0;
}
Comments
Leave a comment