Files
BankManager/bank.h
T

55 lines
1.2 KiB
C
Raw Normal View History

2026-04-06 21:37:41 +08:00
#ifndef BANK_H
#define BANK_H
2026-04-22 17:32:22 +08:00
#define MAX_ACCOUNTS 50 //系统规格为50个账户
#define NAME_LEN 31 //用户名字最长30字符,因此需要多1个字符串结束符
2026-04-06 21:37:41 +08:00
2026-04-22 17:32:22 +08:00
// 账户信息,每个账户id对应了名字、账户余额等信息,是不是用数据结构定义比较合适?
2026-04-06 21:37:41 +08:00
typedef struct strAccount
{
int id;
char name[NAME_LEN];
double balance;
int password;
int quanxian;//1,admin:2,user
} STACCOUNT;
// strAccount STACCOUNT;
2026-04-22 17:32:22 +08:00
// 函数声明,main函数中调用的各模块函数需要在程序公用的.h中声明
// 公开出来被其他模块调用的函数,也应该在公用的.h中声明
2026-04-06 21:37:41 +08:00
2026-04-22 17:32:22 +08:00
//创建账户的函数
2026-04-06 21:37:41 +08:00
void CreateAccount(int quanxian);
2026-04-22 17:32:22 +08:00
//实现存款的函数
2026-04-06 21:37:41 +08:00
void Deposit(int id);
2026-04-22 17:32:22 +08:00
//实现取款的函数
2026-04-06 21:37:41 +08:00
void Withdraw(int id);
2026-04-22 17:32:22 +08:00
//查询余额的函数
2026-04-06 21:37:41 +08:00
void QueryBalance(int id);
2026-04-22 17:32:22 +08:00
//显示全部账户的函数
2026-04-06 21:37:41 +08:00
void ShowAccounts();
2026-04-22 17:32:22 +08:00
//数据持久化函数
2026-04-06 21:37:41 +08:00
void SaveData();
2026-04-22 17:32:22 +08:00
//加载数据的函数
2026-04-06 21:37:41 +08:00
void LoadData();
2026-04-22 17:32:22 +08:00
//根据ID查找账户数组id的函数
2026-04-06 21:37:41 +08:00
int FindAccount(int iD);
2026-04-22 17:32:22 +08:00
//登录函数,返回用户权限
2026-04-06 21:37:41 +08:00
int LoginAccount(int temp_id);
2026-04-22 17:32:22 +08:00
//销户
2026-04-06 21:37:41 +08:00
void DeleteAccount(int id);
void InitAdminAccount();
#endif