50% found this document useful (8 votes)
12K views

Departmental Store C++ Source Code

This C++ program defines a class called "item" that represents items in a bill. The class contains member functions to get data about items like name, quantity, and price, compute the total amounts and discounts, and show a final bill report. The main function creates an instance of the item class, calls the member functions to get data, compute totals, and display the final bill with item details, subtotals, discounts, and grand total.

Uploaded by

Raj Malya
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
50% found this document useful (8 votes)
12K views

Departmental Store C++ Source Code

This C++ program defines a class called "item" that represents items in a bill. The class contains member functions to get data about items like name, quantity, and price, compute the total amounts and discounts, and show a final bill report. The main function creates an instance of the item class, calls the member functions to get data, compute totals, and display the final bill with item details, subtotals, discounts, and grand total.

Uploaded by

Raj Malya
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<conio.

h>
#include<iostream.h>
class item
{
char name[20],address[20],goods[20][20];
int i,n,s[10];
float p[20],d,q[20],x,t[20],z;
public:
void getdata()
{
cout<<"enter the name :";
cin.getline(name,20);
cout<<endl<<"enter the address :";
cin.getline(address,20);
cout<<endl<<"enter the numbers of items :";
cin>>n;
}
void compute()
{
for(i=0;i<n;i++)
{
cout<<endl<<"enter the name of the item :";
cin>>goods[i];
cout<<endl<<"enter the quantity the item :";
cin>>q[i];
cout<<endl<<"enter the price :";
cin>>p[i];
cout<<"enter the discount :";
cin>>d;
t[i]=p[i]*q[i];
x=t[i]+x;
d=t[i]*d/100;
z=z+d;
}}
void show()
{
cout<<"**************************************bill**********************************
****";
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"S.NO."<<"\t"<<"item name"<<"\t"<<"quantity"<<"\t"<<"price"<<"\t"<<"total
amount"<<endl;
for(i=0;i<n;i++)
{
s[i]=i+1;
cout<<" "<<s[i]<<"\t"<<" "<<goods[i]<<"\t"<<" "<<q[i]<<"\t"<<"
"<<p[i]<<"\t"<<" "<<t[i]<<endl;
}
cout<<"****************************************************************************
****";
cout<<endl<<" TOTAL AMOUNT :"<<x;
cout<<endl<<" LESS DISCOUNT : "<<z;
cout<<endl<<" -----";
cout<<endl<<" GRAND TOTAL :"<<x-z;
}
};
void main()
{
cout<<"**********************************BY RAGHU
REHAN******************************";
clrscr();
item g;
g.getdata();
g.compute();
cout<<endl;
cout<<endl;
g.show();
getch();
}

You might also like