5 Star 0 Fork 0

大二上小学期 / 管理系统

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
login.h 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define true 1
#define false 0
struct Account
{
char id[20];
char password[20];
struct Account* next;
};
struct Account* getData()//将数据库以以上结构体链表形式储存,且head为表头指针
{
struct Account* head;
head =
return head;
}
int main()
{
char temid[20]={0}, tempassword[20]={0};
int checkId(char*, char*);
printf("id:\n");
scanf("%s", temid);//输入账号
printf("password:\n");
scanf("%s", tempassword);//输入密码
printf("%d",checkId(temid, tempassword));
return checkId(temid, tempassword);//合法返回1.非法返回0
}
int checkId(char* temid, char* tempassword)
{
char *p1=NULL;
char *p2=NULL;
struct Account* pmove;
int answer = false;
pmove =getData();
while (pmove != NULL)
{
p1=&(pmove->id[0]);
p2=&(pmove->password[0]);
if (strcmp(temid,p1)==0 && strcmp(tempassword,p2)==0)
answer = true;
pmove = pmove->next;
};
return answer;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sophomore-in-primary-school/management-system.git
git@gitee.com:sophomore-in-primary-school/management-system.git
sophomore-in-primary-school
management-system
管理系统
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891