c语言 制作用户名密码,用C语言程序编写用户名密码 程序

优质回答 回答者:贾会根

#include

#include

void main()

{

int i,flag1,flag2;

char name[20]="lushan",password[10]="123456";

char person[20],password1[10];

for(i=0;i!=3;)

{

printf("Please input the name:\n");

gets(person);

flag1=strcmp(person,name);

printf("Please input the password:\n");

gets(password1);

flag2=strcmp(password,password1);

if(flag1==0&&flag2==0)

{

printf("Pass successfully!");

break;

}

else

{

printf("You have enter the wrong name or password!\n");

i++;

}

}

}

-----------------------------------------------------------------

回答者:DUFan

#include "stdio.h"

#include

#include

main()

{

char code1[7];

char code2[7];

int i=0;

printf("please input password with six numbers:");

do{ code1[i]=bioskey(0);

printf("*");

}while(i++!=5);

code1[i]='\0';

printf("\n\nplease input password again:");

i=0;

do{ code2[i]=bioskey(0);

printf("*");

}while(i++!=5);

code2[i]='\0';

if(strcmp(code1,code2)==0) printf("\nYES");

else printf("\nerror");

getchar();

}

输入是3次的话自己加个循环哈;

呵呵

TAGS: 用户名密码

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值