book store inventory system

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)
{
clrscr();
cout<<setw(50)<<"LIBRARY 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;
}
}

void main()
{
clrscr();
library o1;
o1.getdata();
o1.display();
getch();
}



what is wrong with this code?? im trying to view the output.. but still having a error..i use devc++ program with this pls help me!!
Do yourself a favour; throw away your decade old compiler and get a C++ compiler. Stop using char arrays and use proper C++ strings. Stop using conio. Stop using header files that end with '.h' Stop using clrscr. Don't use getch. Don't use void main() - it's wrong. Just plain wrong. Use int main().
It's all good exept for what moschops said:
use int main() with return 0; at the end;
dont use clrscr;
remove the .h from iostream and iomanip;
type using namespace std; right after that include-s, before the code;
don't use conio.h, use cstdlib instead, and instead of getch use system ("pause").
i did that and it all works like a charm, a realy nice code!
i can pase the whole WORKING program in here, but from the tips you can fix it on your own.
Oh, one more thing: the "void" declaration inside the function parethetehitis(i don't know the word, i mean the ()-s) is useless, it knows it's void if there's nothing in there.
Topic archived. No new replies allowed.