#include #include #include #include "bank.h" extern STACCOUNT g_astAccounts[]; extern int g_iAccCount; /* 函数功能:处理用户的创建账户操作 思考处理步骤,写到函数体内注释 * 参数:无 * 存款信息要写入全局变量g_astAccounts中 * 返回值:无 * 存款失败怎么处理? */ void InitAdminAccount() { printf("初始化默认管理员账户"); g_astAccounts[0].id = 1000; strcpy(g_astAccounts[0].name, "admin"); g_astAccounts[0].balance = 0.0; g_astAccounts[0].password = 123456; g_astAccounts[0].quanxian = 1; SaveData(); } void CreateAccount(int quanxian) { // (1)合法性检查 if(MAX_ACCOUNTS < g_iAccCount) { printf("账户数量已达上限!\n"); return; } // (2)定义局部变量(函数内使用的变量) STACCOUNT stNewAcc; //账户变量,结构体变量定义 //char cInput[NAME_LEN]; //接输入的名字字符串 // (3)功能实现 printf("请输入姓名(最多30个字符): "); //这里有风险,怎么改进? scanf("%30s", stNewAcc.name); //stNewAcc.name[NAME_LEN - 1] = '\0'; // 确保null终止 //输密码 int temp_password; while (1) { printf("请输入密码\n"); scanf("%d",&temp_password); if (99999