-
Notifications
You must be signed in to change notification settings - Fork 0
/
学科竞赛管理系统.cpp
117 lines (104 loc) · 2.39 KB
/
学科竞赛管理系统.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
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
// 学科竞赛管理系统.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "List.h"
#include "Role.h"
#include "Student.h"
#include "Manager.h"
#include "MatchInfo.h"
int operation, n;
string account, password;
Status i;
void Menu() {
cout << "--------------------学科竞赛管理系统--------------------" << endl << endl;
cout << " 1、学生注册 " << endl << endl;
cout << " 2、学生登录 " << endl << endl;
cout << " 3、管理员登录 " << endl << endl;
cout << " 4、退出 " << endl << endl;
cout << "------------------------------------------------------" << endl << endl;
}
void LoadMatch(List **L)
{
fstream file;
file.open("MatchInfo.txt", ios::in);
List *p = *L;
while (file.peek() != EOF) {
List *n = new List;
getline(file, n->data.matchID);
getline(file, n->data.matchTitle);
getline(file, n->data.matchTime);
getline(file, n->data.matchAddress);
getline(file, n->data.matchContent);
getline(file, n->data.matchPrincipal);
n->next = NULL;
p->next = n;
p = p->next;
}
file.close();
}
int main()
{
Student *S = new Student();
Manager *m = new Manager();
List *L = new List();
L->InitList(L);
LoadMatch(&L);
//m->Display();
//L->ListInsert(L, n);
//L->ListTraverse(L);
while (true) {
Menu();
cout << "请选择相应操作数—— "; cin >> operation;
switch (operation) {
case 1:
system("cls");
S->Register(account, password);
system("pause");
system("cls");
break;
case 2:
system("cls");
i=S->Login(account, password);
//i = 1;
if (i) {
cout << "登陆成功!" << endl << endl;
S->AfterLogin(S,L);
}else
cout << "登录失败!" << endl << endl;
system("pause");
system("cls");
break;
/*case 3:
system("cls");
S->JoinMatch(S, L);
system("pause");
system("cls");
break;*/
case 3:
system("cls");
i=m->Login(account, password);
//i = 1;
if (i) {
cout << "成功登陆!" << endl << endl;
m->QuerryMatch();
m->AfterLogin(L);
system("cls");
}
else {
cout << "登陆失败!" << endl << endl;
system("pause");
system("cls");
}
break;
case 4:
cout << endl;
cout << "成功退出学科竞赛管理系统!" << endl << endl;
exit(0);
default:
cout << endl << "当前输入有误,请按规定指令输入!" << endl << endl;
system("pause");
system("cls");
}
}
return 0;
}