Create a C++ class InvoiceBill with data members Order_id, O_Date, Customer_Name, No_of_Products, Prod_Name[], Quantity[], Pro d_Price[]. A Customer can buy ' n' products. Accept quantity for each product. Generate and Display the bill using app ropriateManipulators .(Use new operator)
#include<conio.h>
#include<string.h>
int oid,No_of_Products;
int quntity[10],price[10],k;
char name[10],pname[10][30];
void getdata()
{
cout<<"\n\n Enter the name:- ";
cin>>name;
cout<<"\n\n Enter the oid:- ";
cin>>oid;
cout<<"\n\n Enter the No_of_Products:- ";
cin>>No_of_Products;
for(k=0;k<No_of_Products;k++)
{
cout<<"\n\n Enter the pname:- ";
cin>>pname[k];
cout<<"\n\n Enter the quntity:- ";
cin>>quntity[k];
cout<<"\n\n Enter the price:- ";
cin>>price[k];
}
}
{
cout<<"\n Oid:-"<<oid;
cout<<"\n Name:-"<<name;
cout<<"\n No_of_Products:-"<<No_of_Products;
for(k=0;k<No_of_Products;k++)
{
cout<<"\n PName:-"<<pname[k];
cout<<"\n Quantity:-"<<quntity[k];
cout<<"\n Price:-"<<price[k];
}
}
void calculate()
{
int total=0;
for(k=0;k<No_of_Products;k++)
{
//cout<<"Bill.:-"<<quntity[k]*price[k];
total+=quntity[k]*price[k];
}
cout<<"\n Total Amount:-"<<total;
}
};
const int size=2;
{
//inventory * d=p;
int i,n;
cout<<"\n How many records you waant?";
cin>>n;
for(i=0;i<n;i++)
{
p[i].getdata();
}
{
p[i].display();
}
for(i=0;i<n;i++)
{
p[i].calculate();
}
getch();