Repository navigation
Expand file tree
/
Copy pathstart.c
More file actions
143 lines (129 loc) · 2.35 KB
/
Copy pathstart.c
File metadata and controls
143 lines (129 loc) · 2.35 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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include"start.h"
#include"input.h"
#include"global.h"
#include"user.h"
#include"menu.h"
#include"auxiliary.h"
#include"contact.h"
#include"file_rw.h"
void start_1()
{
while(1)
{
printf("\n");
menu_1();//登录注册界面展示
printf("请输入序号:");
char choice = get_choice();
switch(choice)
{
case '1':
reg();//注册账号
break;
case '2':
login();//登录账号
break;
case '3':
return;//退出系统
case '4':
show(H_user);//查看账号
break;
case '#':
start_admin();
break;
default:
printf("请输入指定序号,请重试\n");
}
}
}
void start_2(User_ptr user)
{
initContHash_id(user);
initContHash_name(user);
addr_rfile(user);
while(1)
{
menu_2(user);
printf("请输入序号:");
char choice = get_choice();
switch(choice)
{
case '1'://新建联系人
add_contact(user);
break;
case '2'://查找联系人
search_contact(user);
break;
case '3'://修改联系人
update_contact(user);
break;
case '4'://删除联系人
del_contact(user);
break;
case '5'://查看联系人
show_contact(user);
break;
case '6'://导出通信录
export_address(user);
printf("通信录信息已成功导出\n");
break;
case '7'://辅助功能
start_aux(user);
break;
case '0'://退出登录
addr_wfile(user);//退出登录的时候要写入文件信息
return;
default:
printf("输入有误,请重新输入\n");
}
}
}
void start_aux(User_ptr user)
{
while(1)
{
menu_aux();
printf("请输入序号:");
char choice = get_choice();
switch(choice)
{
case '1'://统计联系人总数
contact_sum(user);
break;
case '2'://统计性别
sex_count(user);
break;
case '3'://初始化通信录
init_addr(user);
break;
case '0'://返回上一级
return;
default:
printf("输入有误,请重新输入\n");
}
}
}
void start_admin()
{
printf("请输入管理员密码:");
char password[INPUT_LEN];
get_login(password, INPUT_LEN);
if(strcmp(password, "admin123") == 0)
{
admin();
}
else
{
printf("密码错误,退出管理员模块\n");
return;
}
}
void admin()
{
menu_admin();
printf("\n");
printf("管理员模块暂未开放使用,来日再见\n");
Exit();
}