library inventory

Message flagged Tuesday, February 21, 2012 4:03 AM
#include <iostream.h>
#include <iomanip.h>
#include <conio.h>


class library
{
char author[15][20],title[15][20];
int price[15];
char pub[15][20];
int s;
public:
void getdata(void);
void display(void);
};


void library :: getdata(void)
{
cout<<"How many Entry you want to make :-";
cin>>s;
for(int i=0;i<s;i++)
{
cout<<"\n\nEnter Author Name :- ";
cin>>author[i];
cout<<"Enter Book Title :- ";
cin>>title[i];
cout<<"Enter Price of Book :- ";
cin>>price[i];
cout<<"Enter Publisher of Book :- ";
cin>>pub[i];
}
}




void library :: display(void)
{


cout<<setw(50)<<"BOOKSTORE DATABASE";
cout<<endl<<endl;
for(int a=0;a<40;a++)
cout<<"*-";
cout<<endl;
cout<<setw(17)<<"AUTHOR NAME"<<setw(20)<<"BOOK TITLE"<<setw(22)<<"PRICE"<<setw(18)<<"PUBLISHER"<<endl;
for(int b=0;b<40;b++)
cout<<"*-";
cout<<endl;


for(int i=0;i<s;i++)
{
cout<<setw(17)<<author[i]<<setw(20)<<title[i]<<setw(22)<<price[i]<<setw(18)<<pub[i]<<endl;
}
}


main()
{


library o1;
o1.getdata();
o1.display();
getch();
}

can you teach me how to edit this code ?? cause i want to add the all price of the book..example I input 3 book then how to total there price...
Whoa. I'd just rewrite this. It's pretty bad
pls teach m cause i dont know how to do it..tnx
Was there your code or code someone else wrote?
Topic archived. No new replies allowed.