Coders Packet

Invoice generator in C++

By Pavithra P

This C++ program is used to generate an INVOICE for any company. After the necessary information of customer, seller and product has been entered, Invoice for the company is generated.

  • Required header files are used.
  • To avoid floating point error the function dummy() is used.
  • Structure bill {} is used because the user is entering number of products they require that is P1,P2,…..Pn. so the variable such as item, qty, price are initialised inside a structure so that we can call these variable for n times.
  • Get the customer and seller detail from the user as an input.
  • flushall() is used to clear all buffers associated with input streams.

do-while is used to perform following function

  • get the product details for product
  • enter ‘y’ each time you wanted to add an product (i++, c++)
  • amount for each product is calculated by quantity*price
  • total amount is calculated by total+amount


  • is used for adding n spaces.
  • Header file should be included for this function.

Invoice is generated when variable rather than ‘y’ is entered i.e while loop condition fails.

Download Complete Code


No comments yet