Return Book function in library management system

What is the right thing to do to create the return function and so i can update the input from the borrow book funtion??

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Transaction 5

if (menu == 5)
{
system("cls");
cout << "=======================================" << endl;
cout << " You choose transaction 5- Borrow Book" << endl;
cout << "=======================================" << endl;
string bookcode;
int idcode, ctr;
ofstream mytransact("transact.txt");

for(ctr=1;ctr<=5;ctr++)
{
ifstream mybook("book.txt");
string bookcode1, booktitle;

ifstream mystudent("student.txt");
string name;
int idcode1;
cout << endl;

cout << "=============================="<< endl;
cout << " 5 - Borrow Book "<< endl;
cout << "=============================="<< endl;
cout << "Enter Book Code : ";
cin >> bookcode;
cout << "Enter Borrowers ID Code : ";
cin >> idcode;

while(mybook >> bookcode1)
{
getline(mybook, booktitle);
if(bookcode1==bookcode)
{
cout << booktitle;
}
}
cout << " was borrowed by";
while(mystudent >> idcode1)
{
getline(mystudent, name);
if(idcode1==idcode)
{
cout << name;
}
}

mytransact << idcode << " " << bookcode << endl;
}
}

// Transaction 6

if (menu == 6)
{
system("cls");
cout << "=======================================" << endl;
cout << " You choose transaction 6- Return Book" << endl;
cout << "=======================================" << endl;
string bookcode;
int idcode, ctr;
Last edited on
You don't even have any functions, what are you really trying to do?
Topic archived. No new replies allowed.