-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.c
74 lines (64 loc) · 1.71 KB
/
page.c
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
//
// Created by Jiayi on 2022/3/6.
//
#include "page.h"
#include "user.h"
#include "book_management.h"
#include "librarian.h"
#include <stdio.h>
//main page for all users:
void main_menu()//show_page模块
{
while (1)
{
load_books();
users_file_to_list();
printf("Please choose an option\n");
printf("1)Register an account\n");
printf("2)Users login\n");
printf("3)Librarian login\n");
printf("4)Display all books\n");
printf("5)Search for book\n");
printf("6)Quit\n");
printf(" Option:");
int option; scanf("%d", &option);
switch (option)
{
case 1: user_register();
break;
case 2: user_login();
break;
case 3: librarian_login();
break;
case 4: display_book();
break;
case 5: search_book_menu();
break;
case 6: return;
default: printf("Invalid option!\n"); break;
}
}
}
void search_book(){
printf("1) Find books by title\n");
printf("2) Find books by author\n");
printf("3) Find books by year\n");
printf("4) Return to previous menu\n");
int choice;
if(choice>=1 && choice<=4){
switch(choice){
case 1:
find_book_by_title(); break;
case 2:
find_book_by_author(); break;
case 3:
find_book_by_year(); break;
default:printf("Sorry, the option you entered was invalid, please try again.");
}
}
else{
printf("Sorry, the option you entered was invalid, please try again.");
}
}
void display_all(){
}