OopProject CPP
OopProject CPP
public:
int id;
string password;
entry()
{
id = count;
count++;
}
void getdata()
{
system("cls");
int entry::count = 1;
class book : public entry
{
protected:
static int book1;
static int book2;
static int book3;
static int book4;
static int book5;
int c = 0;
int cpp = 0;
int dms = 0;
int cgr = 0;
int java = 0;
int day1 = 0;
int day2 = 0;
int day3 = 0;
int day4 = 0;
int day5 = 0;
public:
books_avaliable()
{
cout << endl
<< endl
<< endl
<< endl;
cout << "\t\t\t\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
cout << "\t\t\t\t\t=========================================" << endl;
cout << "\t\t\t\t\t|| book name || || quatity ||" << endl;
cout << "\t\t\t\t\t||--------------------------------------||" << endl;
cout << "\t\t\t\t\t|| c++ book : || || " << book1 << "
||" << endl;
cout << "\t\t\t\t\t|| c book : || || " << book2 << "
||" << endl;
cout << "\t\t\t\t\t|| dms book : || || " << book3 << "
||" << endl;
cout << "\t\t\t\t\t|| cgr book : || || " << book4 << "
||" << endl;
cout << "\t\t\t\t\t|| java book : || || " << book5 << "
||" << endl;
cout << "\t\t\t\t\t=========================================" << endl;
cout << "\t\t\t\t\t-----------------------------------------" << endl;
getchar();
}
void get_book()
{
system("cls");
cout << endl
<< endl
<< endl
<< endl;
cout << "\t\t\t\t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
cout << "\t\t\t\t\t=========================================" << endl;
cout << "\t\t\t\t\t|| book name || || quatity ||" << endl;
cout << "\t\t\t\t\t||--------------------------------------||" << endl;
cout << "\t\t\t\t\t|| c++ book : || || " << book1 << "
||" << endl;
cout << "\t\t\t\t\t|| c book : || || " << book2 << "
||" << endl;
cout << "\t\t\t\t\t|| dms book : || || " << book3 << "
||" << endl;
cout << "\t\t\t\t\t|| cgr book : || || " << book4 << "
||" << endl;
cout << "\t\t\t\t\t|| java book : || || " << book5 << "
||" << endl;
cout << "\t\t\t\t\t=========================================" << endl;
cout << "\t\t\t\t\t-----------------------------------------" << endl;
getchar();
do
{
cout << "enter the number which book do you want to get" << endl;
cout << "\n1.c++ \n2.c\n3.dms\n4.cgr\n5.java\n6.exit" << endl;
cin >> choice;
switch (choice)
{
case 1:
cout << "enter how many quantity do you want to get" << endl;
cin >> quantity;
void displaybook()
{
getchar();
cout << "you get the book....................." << endl;
cout << "======================================" << endl;
cout << "NAME : || QUANTITY || NO. OF DAYS ||" << endl;
cout << " c++ : || " << cpp << " ||days :" << day1 << endl;
cout << " c : || " << c << " || days :" << day2 << endl;
cout << " dms : || " << dms << " || days :" << day3 << endl;
cout << " cgr : || " << cgr << " || days :" << day4 << endl;
cout << " java : || " << java << " || days :" << day5 << endl;
}
void return_book()
{
system("cls");
int quantity, choice;
A:
cout << "enter the choice do you want to return the books" << endl;
cout << "\n1.c++ \n2.c\n3.dms\n4.cgr\n5.java\n6.exit" << endl;
cin >> choice;
switch (choice)
{
case 1:
if (cpp == 0) // for checking user get a book or not
{
cout << "you do not get any book so how you can return the book" <<
endl
<< "please enter the right choice !!!!" << endl;
goto A;
}
samarth:
cout << "how many quantity of cpp books do you want to return" << endl;
cin >> quantity;
if (quantity > cpp)
{
cout << "you do not get " << quantity << " so how you can return "
<< quantity << " quantity" << endl;
goto samarth;
}
else if (quantity <= 0)
{
cout << "not possible !!" << endl;
goto samarth;
}
else
{
book1 = book1 + quantity;
cpp = cpp - quantity;
goto A;
}
break;
case 2:
break;
case 4:
{
cout << "not possible !!" << endl;
goto SJ;
}
else
{
book4 = book4 + quantity;
cgr = cgr - quantity;
goto A;
}
break;
case 5:
break;
case 6:
break;
default:
getchar();
cout << "invalid input" << endl;
break;
}
}
};
int book::book1 = 5;
int book::book2 = 5;
int book::book3 = 5;
int book::book4 = 5;
int book::book5 = 5;
struct node
{
book e;
struct node *next;
};
struct node *insertatend(struct node *head)
{
if (head == NULL)
{
head = new struct node;
head->e.getdata();
head->next = NULL;
return head;
getchar();
}
else
{
struct node *p;
struct node *ptr = new struct node;
ptr->e.getdata();
ptr->next = NULL;
p = head;
while (p->next != NULL)
{
p = p->next;
}
p->next = ptr;
return head;
}
}
struct node *display(struct node *head, int search)
{
struct node *p;
p = head;
while (p != NULL)
{
if (p->e.id == search)
{
string pass;
pa:
cout << "enter your password\n";
cin >> pass;
if (p->e.password == pass)
{
p->e.putdata();
break;
}
else
{
cout << "incorrect password !" << endl;
goto pa;
}
}
p = p->next;
}
if (p == NULL)
{
cout << "no data found....." << endl;
getchar();
}
}
struct node *edit(struct node *head, int search)
{
struct node *p;
p = head;
while (p != NULL)
{
if (p->e.id == search)
{
string pass; // temperary variable for store the password
pa:
cout << "enter your password\n";
cin >> pass;
if (p->e.password == pass)
{
p->e.edit();
break;
}
else
{
cout << "incorrect password !" << endl;
goto pa;
}
}
p = p->next;
if (p == NULL)
{
cout << "no data found........." << endl;
getchar();
}
}
}
p->e.books_avaliable();
}
struct node *get(struct node *head, int search)
{
struct node *p;
p = head;
while (p != NULL)
{
if (p->e.id == search)
{
string pass;
pa:
cout << "enter your password\n";
cin >> pass;
if (p->e.password == pass)
{
p->e.get_book();
break;
}
else
{
cout << "incorrect password !" << endl;
goto pa;
}
}
p = p->next;
}
if (p == NULL)
{
cout << "id not found..................." << endl;
cout << "if you are not register your name in this library then please
first register your detalis\n\n";
getchar();
}
}
struct node *ret(struct node *head, int search)
{
struct node *p;
p = head;
while (p != NULL)
{
if (p->e.id == search)
{
string pass;
pa:
cout << "enter your password\n";
cin >> pass;
if (p->e.password == pass)
{
p->e.displaybook();
p->e.return_book();
break;
}
else
{
cout << "incorrect password !" << endl;
goto pa;
}
}
p = p->next;
}
if (p == NULL)
{
cout << "id not found..................." << endl;
cout << "if you are not register your name in this library then please
first register your detalis\n\n";
getchar();
}
}
int main()
return 0;
}