代码拉取完成,页面将自动刷新
#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;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。