-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
124 lines (114 loc) · 1.97 KB
/
main.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
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
#define _CRT_SECURE_NO_WARNINGS 1
#pragma once
#include <stdio.h>
#include<stdlib.h>
#include "model.h"
//定义卡的结构体
#include"menu.h"
//菜单栏:添加卡,查询卡,上机,下机,充值,退费,查询统计,注销函数
#include"tool.h"
#include"global.h"
#include"service.h"
#pragma once
//时间工具
int main(void) {
Cardnode* pcardnodehead = NULL;
Billingnode* pheadBillingnode = NULL;
MoneyInfo* pheadmoneyinfo = NULL;
if (readCard(&pcardnodehead, CardPath) == 0) {
printf("数据错误1!\n");
return 0;
}
if (readBilling(&pheadBillingnode, BillingPath) == 0) {
printf("数据错误2!\n");
return 0;
}
int serial = -1; //定义用户输入的序号
printf("欢迎进入计费管理系统\n");
do {
outputmenu();
serial = -1;
(void)scanf("%d", &serial);
char c;
while (c = getchar() != '\n');
switch (serial) {
case 1: {
addcard(&pcardnodehead);
break;
}
case 2: {
query(pcardnodehead);
break;
}
case 3: {
shangji(pcardnodehead, &pheadBillingnode);
break;
}
case 4: {
xiaji(pcardnodehead, pheadBillingnode);
break;
}
case 5: {
addMoney(pcardnodehead);
//充值 recharge
break;
}
case 6: {
refundMoney(pcardnodehead);
//退费 refund
break;
}
case 7: {
int cntt = -1;
do {
outputmenu7();
(void)scanf("%d", &cntt);
switch (cntt)
{
case 1: {
statNewCard(pcardnodehead);
break;
}
case 2: {
allmoney(MoneyPath);
break;
}
case 3: {
tongjibilling(BillingPath);
break;
}
case 4: {
findzhuxiao(CardPath);
break;
}
default:
break;
}
} while (cntt != 0);
break;
}
case 8: {
printf("注销卡\n");
zhuxiao(pcardnodehead);
//注销卡 logout
break;
}
case 9: {
printf("激活卡\n");
jihuo(pcardnodehead);
break;
}
case 0: {
releaseCard(pcardnodehead);
releaseBilling(pheadBillingnode);
break;
}
default: {
system("cls");
printf("输入菜单编号无效!\n");
break;
}
}
} while (serial != 0);
return 0;
}