注册登录系统的意义c语言,用c语言写的简易注册登录系统(大一期末作品)

此为本人大一期末作品,分享出来,供大家参考使用,由于当时刚学习编程,如有不足之处请谅解。

//用c语言写的简易注册登录系统(大一期末作品)

#include

#include

#include

#include

struct nap

{

char user[128];

char key[128];

};

struct nap change[128];

typedef int JUDGE;

typedef int LOOP;

int main()

{

int reg(void);

int landing(void);

char number;

do

{

printf("\n1.Register\http://doc.xuehai.netnding\nPlease choose the number(1 or 2):");

fflush(stdin);

scanf("%c",&number);

}while(number!='1'&&number!='2');

switch (number)

{

case '1':

reg(); break;

case '2':

landing();

}

system("pause");

return 0;

}

int reg(void)

{

int compare(char *,char *);

int increase(void);

void putIn(char *);

JUDGE turn,n=0;

char filePassword[9]={"12348888"},password[128];

char * p=password;

do

{

printf("\nPlease enter the administrator password:");

fflush(stdin);

putIn(p);

turn=compare(password,filePassword);

n++;

if(turn==0&&n<=3)

{

printf("\nWrong password!\nPlease enter again!\n");

}

else if(n>3)

{

printf("\nYou entered too many times!\n");

return 0;

}

}while(turn==0);

increase();

}

int compare(char * p,char * q)

{

while(*p!='\0'&&*q!='\0')

{

if(*p!=*q)

{

return 0;

}

else

{

p++;

q++;

}

}

if(*p==*q)

{

return 1;

}

return 0;

}

int increase(void)

{

void putIn(char *);

int catch(JUDGE);

int userLoopCompare(char *,int * h);

JUDGE i,n=0,m=0,j=1,h=0;

FILE * fp;

char tem[128],compar[128],*q=compar,* p=tem;

do

{

do

{

printf("\nPlease enter the user name:");

gets(p);

n++;

if(*p=='\0'&&n<=3)

{

printf("\nYou did not enter the user name,please enter again!\n");

}

else if(n>3)

{

printf("\nYou entered too many times!\n");

return 0;

}

}while(*p=='\0');

m=0;

p=p+strlen(tem);

*p='\n';

p++;

*p='\0';

p=tem;

catch(j);

i=userLoopCompare(p,&h);

m++;

if(i==0&&m<=3)

{

printf("\nThe user name has been registered!\nPlease enter again!\n");

}

else if(m>3)

{

printf("\nYou entered too many times!\n");

return 0;

}

}while(i==0);

p=p+strlen(tem);

if(*(p-2)=='\n')

{

p--;

}

n=0;

do

{

m=0;

do

{

m++;

printf("\nPlease enter the password:");

putIn(p);

if(*p=='\0'&&m<=3)

{

printf("\nYou did not enter the password!\nPlease enter again!\n");

}

else if(m>3)

{

printf("\nYou entered too many times!\n");

return 0;

}

}while(*p=='\0');

printf(&qu

ot;\nPlease enter the password again:");

putIn(q);

i=compare(p,q);

if(i==1)

{

p=tem;

}

else

{

n++;

if(n<=3)

{

printf("\

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值