-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrarian.cpp
More file actions
44 lines (44 loc) · 1.2 KB
/
Librarian.cpp
File metadata and controls
44 lines (44 loc) · 1.2 KB
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
#include "bits/stdc++.h"
#include "classes.hpp"
// #include "Student.cpp"
// #include "Faculty.cpp"
// #include "Book.cpp"
// #include "Accounts.cpp"
// #include "Library.cpp"
using namespace std;
string Librarian::libLogin()
{
string userID, password;
int trials = 5;
while (true)
{
cout << "############################################" << endl;
cout << "# LIBRARIAN LOGIN #" << endl;
cout << "############################################" << endl;
cout << endl;
cout << "Enter userID: ";
cin >> userID;
cin.clear();
cin.ignore(10000, '\n');
cout << "Enter password: ";
cin >> password;
cin.clear();
cin.ignore(10000, '\n');
if (libAccount().authenticate(userID, password))
{
cout << "Login successful!" << endl;
return userID;
}
else
{
cout << "Invalid credentials!" << endl;
trials--;
if (trials == 0)
{
cout << "Maximum trials reached!" << endl;
return "";
}
cout << "Trials left: " << trials << endl;
}
}
}