有部分功能是用来测试的可删掉;
可以应付验收
注释掉最后的清屏函数有助于了解该系统
可提前一周看一下代码,了解工能后即可验收
功能简介
1.添加卡
2.查询卡
3.上机
4.下机
5.充值
6.退费
7.注销卡
8.激活卡
9.统计卡信息
10.一段时间的营业额
11.printf //记录上机时间 消费金额 下机时间 余额 状态
0.退出
#define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
#include
//#include"tool.h"
#define danjia 0.100000 //单价0.1元每秒
void timeToString(time_t t, char* pBuf)
{
struct tm* timeinfo;
timeinfo = localtime(&t);
strftime(pBuf, 20, "%Y-%m-%d %H:%M", timeinfo);
}
time_t stringToTime(char* pTime)
{
struct tm tml;
time_t time1;
sscanf(pTime, "%d-%d-%d %d:%d", &tml.tm_year, &tml.tm_mon, &tml.tm_mday, &tml.tm_hour, &tml.tm_min);
tml.tm_year -= 1900; //年份为从1900年开始
tml.tm_mon -= 1; //月份为1^11
tml.tm_sec = 0;
tml.tm_isdst -= -1;
time1 = mktime(&tml);
return time1;
}
//上几结构体
struct Card
{
char aName[11]; // 卡号
char aPwd[8]; // 密码
int nStatus; // 卡状态(0-未上机;1-正在上机;2-已注销)
time_t tStart; // 开卡时间
time_t tEnd; // 卡的截止时间
float fTotalUse; // 累计金额
time_t tLast; // 最后使用时间
int nUseCount; // 使用次数
float fBalance; // 余额
int nDel; // 删除标识 0-未删除,1-删除
};
struct Node
{
struct Card data;
struct Node* next;
};
struct Node* list = NULL;
//创建表头:表头就是一个结构体变量
struct Node* creatHead()
{ //动态内存申请
struct Node* headNode = (struct Node*)malloc(sizeof(struct Node));
headNode->next = NULL;
return headNode;
}
//创造节点:为插入作准备
//把用户的数据变为结构体变量
struct Node* creatNode(struct Card data)
{ //动态内存申请
struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
newNode->data = data;
newNode->next = NULL;
return newNode;
}
//插入
void insertNodeByHead(struct Node* headNode, struct Card data)
{ //必须先连接后断开
struct Node* newNode = creatNode(data);
newNode->next = headNode->next;
headNode->next = newNode;
}
//上几结构体
struct shangji
{
char aName[11]; // 卡号
time_t tStart; // 上机时间
float fBalance;// 余额
int zhuangtai;//结算状态0未结算1已结算
};
struct shang
{
struct shangji data;
struct shang* next;
};
struct shang* list2 = NULL;
//创建表头:表头就是一个结构体变量
struct shang* creatHeadshang()
{ //动态内存申请
struct shang* headshang = (struct shang*)malloc(sizeof(struct shang));
headshang->next = NULL;
return headshang;
}
//创造节点:为插入作准备
//把用户的数据变为结构体变量
struct shang* creatshang(struct shangji data)
{
struct shang* newshang = (struct shang*)malloc(sizeof(struct shang));
newshang->data = data;
newshang->next = NULL;
return newshang;
}
//插入
void insertshangByHead(struct shang* headshang, struct shangji data)
{ //必须先连接后断开
struct shang* newshang = creatshang(data);
newshang->next = headshang->next;
headshang->next = newshang;
}
//下机信息结构体
struct xiaji
{
char aName[11]; // 卡号
time_t tStart; // 上机时间
float fAmount; // 消费金额
time_t tEnd; // 下机时间
float fBalance;// 余额
int zhuangtai;
};
struct xia
{
struct xiaji data;
struct xia* next;
};
struct xia* list3 = NULL;
struct xia* creatHeadxia()
{ //动态内存申请
struct xia* headxia = (struct xia*)malloc(sizeof(struct xia));
headxia->next = NULL;
return headxia;
}
struct xia* creatxia(struct xiaji data)
{
struct xia* newxia = (struct xia*)malloc(sizeof(struct xia));
newxia->data = data;
newxia->next = NULL;
return newxia;
}
void insertxiaByHead(struct xia* headxia, struct xiaji data)
{ //必须先连接后断开
struct xia* newxia = creatxia(data);
newxia->next = headxia->next;
headxia->next = newxia;
}
//充退费结构体
struct Money
{
char aName[11]; // 卡号
int nStatus; // 卡状态(0表示充值;1表示退费;)
time_t tTime; // 时间
float fMoney; // 充值退费金额
int nDel; // 删除标识 0-未删除,1-删除
};
struct chongtuifei
{
struct Money data;
struct chongtuifei* next;
};
struct chongtuifei* list4 = NULL;
struct chongtuifei* creatHeadchongtuifei()
{ //动态内存申请
struct chongtuifei* headchongtuifei = (struct chongtuifei*)malloc(sizeof(struct chongtuifei));
headchongtuifei->next = NULL;
return headchongtuifei;
}
struct chongtuifei* creatchongtuifei(struct Money data)
{
struct chongtuifei* newchongtuifei = (struct chongtuifei*)malloc(sizeof(struct chongtuifei));
newchongtuifei->data = data;
newchongtuifei->next = NULL;
return newchongtuifei;
}
void insertchongtuifeiByHead(struct chongtuifei* headchongtuifei, struct Money data)
{ //必须先连接后断开
struct chongtuifei* newchongtuifei = creatchongtuifei(data);
newchongtuifei->next = headchongtuifei->next;
headchongtuifei->next = newchongtuifei;
}
//指定位删除函数
void deleteNodeByData(struct Node* headNode, char* cardname)
{
struct Node* posLeftNode = headNode;
struct Node* posNode = headNode->next;
//卡名是字符串,要用字符串比较函数
while (posNode != NULL && strcmp(posNode->data.aName, cardname))
{
posLeftNode = posNode;
posNode = posLeftNode->next;
}
//讨论查找结果
if (posNode == NULL)
return;
else
{
posLeftNode->data = posNode->data;
free(posNode);
posNode = NULL;
}
}
//查找卡信息函数
struct Node* searchByName(struct Node* headNode, char* CardaName)
{
struct Node* posNode = headNode->next;
while (posNode != NULL && strcmp(posNode->data.aName, CardaName))
{
posNode = posNode->next;
}
return posNode;
}
void tongji(struct xia* headxia)
{
char a[6];
struct xia* aMove = headxia->next;
float all = 0;
long long int kaishi;
long long int jiezhi;
char shangxian[21];
char xiaxian[21];
printf("请输入起始时间如2010-10-01 12:11\n");
gets_s(a, 6);
gets_s(shangxian, 20);
printf("请输入截至时间如2010-10-01 12:11\n");
gets_s(xiaxian, 20);
kaishi = stringToTime(shangxian);
jiezhi = stringToTime(xiaxian);
while (aMove != NULL)
{
if (aMove->data.tEnd <= jiezhi && aMove->data.tEnd >= kaishi)
{
all = all + aMove->data.fAmount;
}
else
{
}
aMove = aMove->next;
}
printf("营业额:%f\n", all);
}
void printflist3(struct xia* headxia)
{
struct xia* pMove = headxia->next;
int i = 0;
while (pMove != NULL)
{
char a[20];
char b[20];
timeToString(pMove->data.tStart, a);
timeToString(pMove->data.tEnd, b);
printf("卡号\t\t上机时间\t消费金额\t\t下机时间\t\t 余额\t\t状态\n");
printf("%s\t\t%s\t%f\t\t%s\t%f\t%d\n", pMove->data.aName, a, pMove->data.fAmount, b, pMove->data.fBalance, pMove->data.zhuangtai);
pMove = pMove->next;
}
}
//打印卡信息函数
void printList(struct Node* headNode)
{
struct Node* pMove = headNode->next;
int i = 0;
while (pMove != NULL)
{
char a[20];
char b[20];
char c[20];
timeToString(pMove->data.tStart, a);
timeToString(pMove->data.tEnd, b);
timeToString(pMove->data.tLast, c);
printf("卡号\t\t密码\t\t上机状态\t 余额\t\t累计金额\t使用次数\t开卡时间\t 上次使用时间\t 截至时间 删除标识符\n");
printf("%-12s\t%s\t\t%d\t\t%15f\t%15f\t%d\t\t%s %s %s %d\n", pMove->data.aName, pMove->data.aPwd,
pMove->data.nStatus, pMove->data.fBalance, pMove->data.fTotalUse, pMove->data.nUseCount, a, c, b, pMove->data.nDel);
i++;
pMove = pMove->next;
}
printf("卡个数%d\n", i);
}
//菜单函数
void outputMenu()
{
printf("\n--------------菜单------------\n");
printf("1.添加卡\n2.查询卡\n3.上机\n4.下机\n5.充值\n6.退费\n7.注销卡\n8.激活卡\n9.统计卡信息\n10.一段时间的营业额\n11.printf\n0.退出\n请选择菜单编号(0-9):");
}
//存储数据函数
void saveInfoToFile(const char* fileName, struct Node* headNode)
{
FILE* fp = fopen(fileName, "w");//创建一个文件指针并打开文间
struct Node* pMove = headNode->next;
while (pMove != NULL)
{ //存储数据
fprintf(fp, "%s\t%s\t%d\t%f\t%d\t%f\t%d\t%lld\t%lld\t\t%lld\n",
pMove->data.aName, pMove->data.aPwd, pMove->data.nStatus,
pMove->data.fBalance, pMove->data.nDel, pMove->data.fTotalUse,
pMove->data.nUseCount, pMove->data.tStart, pMove->data.tLast, pMove->data.tEnd);
pMove = pMove->next;
}
fclose(fp);
}
//读取数据函数
void readInfoToFile(const char* fileName, struct Node* headNode)
{
FILE* fp = fopen(fileName, "r");//以读的方式打开文件
if (fp == NULL)
{
fp = fopen(fileName, "w+");//具有创建的方式打开文件可读可写
}
struct Card tempData;
while (fscanf(fp, "%s\t%s\t%d\t%f\t%d\t%f\t%d\t%lld\t%lld\t\t%lld\n",
tempData.aName, tempData.aPwd, &tempData.nStatus, &tempData.fBalance,
&tempData.nDel, &tempData.fTotalUse, &tempData.nUseCount, &tempData.tStart, &tempData.tLast, &tempData.tEnd) != EOF)
{
insertNodeByHead(list, tempData);
}
fclose(fp);
}
//存储上机数据函数
void saveshangjiFile(const char* fileName, struct shangji shang)
{
FILE* fp = fopen(fileName, "a");//创建一个文件指针并打开文间
fprintf(fp, "%s\t\t%lld\t\t%f\t%d\n", shang.aName, shang.tStart, shang.fBalance, shang.zhuangtai);//存储数据
fclose(fp);
}
//读取上机数据函数
void readshangFile(const char* fileName, struct shang* headshang)
{
FILE* fp = fopen(fileName, "r");//以读的方式打开文件
if (fp == NULL)
{
fp = fopen(fileName, "w+");//具有创建的方式打开文件可读可写
}
struct shangji tempData;
while (fscanf(fp, "%s\t\t%lld\t\t%f\t%d\n",
tempData.aName, &tempData.tStart, &tempData.fBalance, &tempData.zhuangtai) != EOF)
{
insertshangByHead(list2, tempData);
}
fclose(fp);
}
//存储xia机数据函数
void savexiajiFile(const char* fileName, struct xiaji xia)
{
FILE* fp = fopen(fileName, "a");//创建一个文件指针并打开文间
fprintf(fp, "%s\t\t%lld\t\t%f\t\t%lld\t\t%f\t\t%d\n", xia.aName, xia.tStart, xia.fAmount, xia.tEnd, xia.fBalance, xia.zhuangtai);//存储数据
fclose(fp);
}
//读取下机数据函数
void readxiaFile(const char* fileName, struct xia* headxia)
{
FILE* fp = fopen(fileName, "r");//以读的方式打开文件
if (fp == NULL)
{
fp = fopen(fileName, "w+");//具有创建的方式打开文件可读可写
}
struct xiaji tempData;
while (fscanf(fp, "%s\t\t%lld\t\t%f\t\t%lld\t\t%f\t\t%d\n", tempData.aName, &tempData.tStart, &tempData.fAmount, &tempData.tEnd, &tempData.fBalance, &tempData.zhuangtai) != EOF)
{
insertxiaByHead(list3, tempData);
}
fclose(fp);
}
void savechongtuifeiFile(const char* fileName, struct Money chongtuifei)
{
FILE* fp = fopen(fileName, "a");//创建一个文件指针并打开文间
fprintf(fp, "%s\t%f\t%d\t%d\t%lld\n", chongtuifei.aName, chongtuifei.fMoney, chongtuifei.nDel, chongtuifei.nStatus, chongtuifei.tTime);//存储数据
fclose(fp);
}
//存储充退费数据
void readchongtuifeiFile(const char* fileName, struct chongtuifei* headchongtuifei)
{
FILE* fp = fopen(fileName, "r");//以读的方式打开文件
if (fp == NULL)
{
fp = fopen(fileName, "w+");//具有创建的方式打开文件可读可写
}
struct Money tempData;
while (fscanf(fp, "%s\t%f\t%d\t%d\t%lld\n", tempData.aName, &tempData.fMoney, &tempData.nDel, &tempData.nStatus, &tempData.tTime) != EOF)
{
insertchongtuifeiByHead(list4, tempData);
}
fclose(fp);
}
void keyDown()
{
float chongzhijine;//充值金额
long long int alltime;//总耗时
int nSelection = -1;
struct Card tempCard;//产生一个临时变量
struct shangji tempshangji;//产生一个临时变量
struct xiaji tempxiaji;//产生一个临时变量
struct Money tempchongtuifei;//产生一个临时变量
struct Node* result = NULL;//产生一个临时变量
int flag = 1;
scanf_s("%d", &nSelection);//检查序号是否正确
if (nSelection > 11)
{
printf("输入的序号错误,请重新输入序号");
}
else
{
switch (nSelection)
{
case 1://添加卡
for (; flag == 1;)
{
flag = 0;
printf("请你输入卡号【1-10】:\n");
scanf_s("%s", tempCard.aName, 20);
printf("请你输入密码【1-8】\n");
scanf_s("%s", tempCard.aPwd, 16);
printf("请你输入开卡金额\n");
scanf_s("%f", &tempCard.fBalance);
tempCard.nStatus = 0;
tempCard.nDel = 0;
tempCard.nUseCount = 0;
tempCard.fTotalUse = 0;
int nNamesize = strlen(tempCard.aName);//检查卡号和密码是否符和要求
int naPwdsize = strlen(tempCard.aPwd);
result = searchByName(list, tempCard.aName);//连入链表查找卡号,判断卡号是否重复
if (result == NULL)
{
}
else
{
printf("该卡号已存在,请选择其它卡号,请重新添加\n");
flag = 1;
}
if (nNamesize > 10 || naPwdsize > 8)//规范卡号和密码
{
printf("卡号或密码不符合规范!请重新添加卡\n");
flag = 1;
}
}
//获取时间
tempCard.tStart = time(NULL);
tempCard.tLast = time(NULL);
tempCard.tEnd = tempCard.tStart + 31536000;
printf("卡号\t\t密码\t\t上机状态\t\t开卡金额\t\t累计金额\t\t使用次数\n");
printf("%-10s\t%-8s\t%d\t\t%f\t\t%f\t\t%d\n", tempCard.aName, tempCard.aPwd, tempCard.nStatus, tempCard.fBalance, tempCard.fTotalUse, tempCard.nUseCount);
insertNodeByHead(list, tempCard);//将卡信息连入链表
saveInfoToFile("Card.txt", list);
break;
case 2:printf("请输人要查询的卡号:\n");//查询卡信息
scanf_s("%s", tempCard.aName, 15);
result = searchByName(list, tempCard.aName);
if (result == NULL)
{
printf("未找到此卡,请重新查询\n");
}
else
{
if (result->data.nStatus == 2) { printf("该卡已注销\n"); }
else
{
char c[20];
timeToString(result->data.tLast, c);
printf("卡号\t上机状态\t 余额\t\t 删处标记\t 累计金额\t\t使用次数\t 上次使用时间\n");
printf("%s\t%d\t\t%f\t\t%d\t\t%f\t\t%d\t\t%s\n", result->data.aName, result->data.nStatus, result->data.fBalance, result->data.nDel, result->data.fTotalUse, result->data.nUseCount, c);
}
}
break;
case 3:printf("上机\n");//上机
printf("请你输入卡号【1-10】:\n");
scanf_s("%s", tempCard.aName, 20);
printf("请你输入密码【1-8】\n");
scanf_s("%s", tempCard.aPwd, 16);
result = searchByName(list, tempCard.aName);
if (result == NULL)
{
printf("卡号错误,请重新输入卡号\n");
}
else
{
if (result->data.nStatus == 2 || result->data.nStatus == 1) { printf("该卡已注销或该卡已上机,请重新操作\n"); }
else {
if (strcmp(result->data.aPwd, tempCard.aPwd) == 0)
{
if (result->data.fBalance <= 0) { printf("余额不足,请充值后再上机"); }
else
{
printf("上机成功\n");
tempCard.tLast = time(NULL);
tempshangji.tStart = tempCard.tLast;
tempshangji.fBalance = result->data.fBalance;
tempshangji.zhuangtai = 0;
int i;
for (i = 0; i < 11; i++)
tempshangji.aName[i] = '\0';
for (i = 0; tempCard.aName[i]; i++)
tempshangji.aName[i] = tempCard.aName[i];
result->data.tLast = tempCard.tLast;
result->data.nStatus = 1;
saveInfoToFile("Card.txt", list);
insertshangByHead(list2, tempshangji);//将卡信息连入链表
saveshangjiFile("shangji.txt", tempshangji);
char a[20];
timeToString(result->data.tStart, a);
printf("卡号\t上机时间\t余额\n");
printf("%s\t%s\t%f", tempshangji.aName, a, tempshangji.fBalance);
}
}
else
{
printf("密码错误 请重新输入账号密码\n");
}
}
}
break;
case 4:printf("下机");//下机
printf("请你输入卡号【1-10】:\n");
scanf_s("%s", tempCard.aName, 20);
printf("请你输入密码【1-8】\n");
scanf_s("%s", tempCard.aPwd, 16);
result = searchByName(list, tempCard.aName);
if (result == NULL)
{
printf("卡号错误,请重新输入卡号\n");
}
else
{
if (result->data.nStatus == 2 || result->data.nStatus == 0) { printf("该卡已注销或该卡未上机\n"); }
else {
if (strcmp(result->data.aPwd, tempCard.aPwd) == 0)
{
printf("下机成功\n");
tempxiaji.tStart = result->data.tLast;
tempCard.tLast = time(NULL);
tempxiaji.tEnd = tempCard.tLast;
tempCard.fBalance = result->data.fBalance;
alltime = (tempCard.tLast) - (result->data.tLast);//计算上机时长
result->data.fBalance = tempCard.fBalance - alltime * danjia;
result->data.tLast = tempCard.tLast;
tempCard.nUseCount = result->data.nUseCount;
result->data.nUseCount = tempCard.nUseCount + 1;
result->data.nStatus = 0;
result->data.fTotalUse = result->data.fTotalUse + alltime * danjia;
int i;
for (i = 0; i < 11; i++)
tempxiaji.aName[i] = '\0';
for (i = 0; tempCard.aName[i]; i++)
tempxiaji.aName[i] = tempCard.aName[i];
tempxiaji.fAmount = alltime * danjia;
tempxiaji.fBalance = result->data.fBalance;
tempxiaji.zhuangtai = 1;
saveInfoToFile("Card.txt", list);
insertxiaByHead(list3, tempxiaji);
savexiajiFile("xiaji.txt", tempxiaji);
char a[20];
char b[20];
timeToString(tempxiaji.tStart, a);
timeToString(tempxiaji.tEnd, b);
printf("卡号\t\t上机时间\t\t消费金额\t\t下机时间\t\t余额\t\t结算状态\n");
printf("%s\t\t%s\t\t%f\t\t%s\t\t%f\t\t%d", tempxiaji.aName, a, tempxiaji.fAmount, b, tempxiaji.fBalance, tempxiaji.zhuangtai);
}
else
{
printf("密码错误 请重新输入账号密码\n");
}
}
}
break;
case 5:printf("充值");//充值
printf("请输人充值的卡号:\n");//查询卡卡号
scanf_s("%s", tempCard.aName, 15);
result = searchByName(list, tempCard.aName);
if (result == NULL)
{
printf("未找到此卡,请重新充值\n");
}
else
{
if (result->data.nStatus == 2) { printf("该卡已注销,无法充值\n"); }
else
{
int i;
printf("请你输入充值金额\n");
scanf_s("%f", &chongzhijine);
result->data.fBalance = result->data.fBalance + chongzhijine;
saveInfoToFile("Card.txt", list);
printf("充值成功\n你的充值金额为:%f\n", chongzhijine);
tempchongtuifei.fMoney = chongzhijine;
for (i = 0; i < 11; i++)
tempchongtuifei.aName[i] = '\0';
for (i = 0; tempCard.aName[i]; i++)
tempchongtuifei.aName[i] = tempCard.aName[i];
tempchongtuifei.nDel = 0;
tempchongtuifei.nStatus = 0;
tempchongtuifei.tTime = time(NULL);
insertchongtuifeiByHead(list4, tempchongtuifei);
savechongtuifeiFile("chongtuifei.txt", tempchongtuifei);
}
}
break;
case 6:printf("退费");//退费
printf("请你输入要退费的卡号【1-10】:\n");
scanf_s("%s", tempCard.aName, 20);
printf("请你输入密码【1-8】\n");
scanf_s("%s", tempCard.aPwd, 16);
result = searchByName(list, tempCard.aName);
if (result == NULL)
{
printf("卡号错误,请重新输入卡号\n");
}
else
{
if (result->data.nStatus == 2 || result->data.nStatus == 1 || result->data.fBalance < 0)
{
printf("退费失败\n");
}
else
{
int i;
printf("退费成功\n");
printf("退费金额为:%f\n", result->data.fBalance);
tempchongtuifei.fMoney = result->data.fBalance;
for (i = 0; i < 11; i++)
tempchongtuifei.aName[i] = '\0';
for (i = 0; tempCard.aName[i]; i++)
tempchongtuifei.aName[i] = tempCard.aName[i];
tempchongtuifei.nDel = 0;
tempchongtuifei.nStatus = 1;
tempchongtuifei.tTime = time(NULL);
insertchongtuifeiByHead(list4, tempchongtuifei);
savechongtuifeiFile("chongtuifei.txt", tempchongtuifei);
result->data.fBalance = 0;
saveInfoToFile("Card.txt", list);
}
/*printf("请你输入退款金额\n");
scanf_s("%f",&tuifeijine);
if (result->data.fBalance < tuifeijine)
{
printf("余额不足,请重新退款\n");
}
else
{
result->data.fBalance = result->data.fBalance - tuifeijine;
saveInfoToFile("Card.txt", list);
printf("退款金额为:%lf\n余额为:%f",tuifeijine, result->data.fBalance);
}*/
}
break;
case 7:printf("注销卡");//注销卡
printf("请你输入要注销的卡号\n");
scanf_s("%s", tempCard.aName, 20);
printf("请你输入密码【1-8】\n");
scanf_s("%s", tempCard.aPwd, 16);
result = searchByName(list, tempCard.aName);
if (result == NULL)
{
printf("卡号错误,请重新输入卡号\n");
}
else
{
if (result->data.nStatus == 1)
{
printf("注销失败\n");
}
else
{
int i;
result->data.nStatus = 2;
printf("退费%f:", result->data.fBalance);
tempchongtuifei.fMoney = result->data.fBalance;
tempchongtuifei.nStatus = 1;
for (i = 0; i < 11; i++)
tempchongtuifei.aName[i] = '\0';
for (i = 0; tempCard.aName[i]; i++)
tempchongtuifei.aName[i] = tempCard.aName[i];
result->data.fBalance = 0;
tempchongtuifei.nDel = 0;
tempchongtuifei.tTime = time(NULL);
insertchongtuifeiByHead(list4, tempchongtuifei);
savechongtuifeiFile("chongtuifei.txt", tempchongtuifei);
saveInfoToFile("Card.txt", list);
printf("注销卡成功\n");
}
}
break;
case 8:printf("激活卡");//激活卡
printf("请你输入要激活的卡号\n");
scanf_s("%s", tempCard.aName, 20);
printf("请你输入密码【1-8】\n");
scanf_s("%s", tempCard.aPwd, 16);
result = searchByName(list, tempCard.aName);
if (result == NULL)
{
printf("卡号错误,请重新输入卡号\n");
}
else
{
if (result->data.nStatus == 2)
{
result->data.nStatus = 0;
saveInfoToFile("Card.txt", list);
printf("激活卡成功\n");
}
else
{
printf("该卡并未注销,请输入已注销的卡的卡号");
}
}
break;
case 9:printList(list); break;//统计卡信息
case 10:tongji(list3); break;
case 0:
printf("退出\n");
printf("退出成功\n");
exit(0);//退出含数(关闭程序)
break;
case 11: printflist3(list3); break;
}
}
}
int main()
{
list = creatHead();
list2 = creatHeadshang();
list3 = creatHeadxia();
list4 = creatHeadchongtuifei();
readInfoToFile("Card.txt", list);
readshangFile("shangji.txt", list2);
readxiaFile("xiaji.txt", list3);
readchongtuifeiFile("chongtuifei.txt", list4);
while (1)
{
outputMenu();//打印菜单
keyDown();//进入功能含数
system("pause");
system("cls");//清屏函数可注释掉,便与了解该系统
}
system("pause");
return 0;
}