Program to calculate the bill in c++

A program that takes units as input from the user, and unit rates are assigned by the programmer and the program calculates the electricity bill.


How many values need to be stored in a variable?

There are two different rates for each customer. The high rate is for customers with fewer units consumed and low rate is for customers with low units consumed. So we require 2 variables;

  • rate1 and rate2
  • int rate1 and rate2 mean that these two variables only stores integer values.
  • When the user inputs the units, then we need to store the units in a unit variable.
  • When a total bill is calculated, then we need to store the bill in a variable bill.

enter units consumed by the client


Total bill is =  100


Subscribe for Friendship

Latest posts by Prof. Fazal Rehman Shamil (see all)

Buy advertisement space on T4Tutorials

For more details email [email protected]