Академический Документы
Профессиональный Документы
Культура Документы
h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<iomanip.h>
#include<dos.h>
class group
{
protected:
struct books
{
char flag;
char bname[50];
char aname[50];
char pubname[50];
int price;
int noofbooks;
}b;
fstream file;
public:
group();
void insert();
void display();
void update();
void search();
void deletion();
void exit();
};
void main()
{
int choice;
char pass[20];
clrscr();
group g;
y: clrscr();
gotoxy(12,12);
cout<<"ENTER THE PASSWORD :";
cin>>pass;
if(strcmp(pass,"1234")==0)
goto z;
else
{
gotoxy(12,12);
cout<<"INCORRECT PASSWORD";
sound(1000);
delay(1000);
nosound();
clrscr();
goto y;
}
//group g;
z: do
{
clrscr();
gotoxy(30,4);
cout<<"*********************";
gotoxy(30,5);
cout<<"BOOK STORE MANAGEMENT";
gotoxy(30,6);
cout<<"*********************";
gotoxy(30,10);
cout<<"1.insert record";
gotoxy(30,11);
cout<<"2.display";
gotoxy(30,12);
cout<<"3.update";
gotoxy(30,13);
cout<<"4.search";
gotoxy(30,14);
cout<<"5.delete";
gotoxy(30,15);
cout<<"6.exit";
gotoxy(30,20);
cout<<"enter your choice :";
cin>>choice;
clrscr();
switch(choice)
{
case 1:
g.insert();
break;
case 2:
g.display();
break;
case 3:
g.update();
break;
case 4:
g.search();
break;
case 5:
g.deletion();
break;
case 6:
g.exit();
exit(1);
}
}while(choice != 0);
}
void group::group() //zero argument constructor
{
file.open("books.dat",ios::binary|ios::in|ios::out);
if(!file)
{
cout<<endl<<"unable to open the file";
exit();
}
}
void group::exit()
{
file.close();
}