-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibraryManagementSystem.cpp
90 lines (77 loc) · 2.22 KB
/
LibraryManagementSystem.cpp
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <iostream>
#include "BookRecords.h"
#include "LibraryManagementSystem.h"
int main()
{
std::cout << "Welcome in Labrary Management System!\nPlease log in:\n";
int MenuOption, i = 0;
BookRecords BR = BookRecords();
BR.BookRecord();
// Adding Login Information
std::string UsernameSystem = "Vashni";
std::string PasswordSystem = "TSym5nlf982eWNV";
std::string Username, Password;
std::cout << "Username: \n";
std::cin >> Username;
std::cout << "Password: \n";
std::cin >> Password;
bool UserIsLogged = BR.UserIsLogged(Username == UsernameSystem && Password == PasswordSystem);
while (!BR.UserIsLogged(UserIsLogged))
{
std::cout << "Invalid login\nPlease log in:\n";
std::cout << "Username: \n";
std::cin >> Username;
std::cout << "Password: \n";
std::cin >> Password;
++i;
if (i == 5)
{
std::cout << "Too many unsuccessful attempts have been made. The application is terminating";
return 5;
}
};
while (UserIsLogged)
{
std::cout << "User sucessfully loged into system!!!!" << std::endl;
// Begin Main Program Loop
Menu(MenuOption);
switch (MenuOption)
{
case 1:
BR.AddNewBookRecord();
break;
case 2:
BR.UpdateBookRecord();
break;
case 3:
BR.DeleteBookRecord();
break;
case 4:
BR.PrintAllRecord();
break;
case 5:
BR.LogOutMessage(UserIsLogged = false);
break;
case 6:
BR.LogOutMessage(UserIsLogged = false);
break;
default:
return 6;
}
// End Main Program Loop
}
std::cin.get();
return 0;
}
// Menu Function
void Menu(int& MenuOption)
{
std::cout << "What do you wanna do?\n";
std::cout << "1. Add New Book Record\n";
std::cout << "2. Update Existing Book Record\n";
std::cout << "3. Delete Existing Book Record\n";
std::cout << "4. Print All Existing Records\n";
std::cout << "5. Log out\n";
std::cout << "6. Exit Application\n";
std::cin >> MenuOption;
}