用c语言编写检验密码函数 用c语言编写检验密码函数怎么写

用C语言写简单密码检测程序#include stdio.h
#include string.h
#include stdlib.h
#define pi 3.1415926
float area(float s);
void main()
{
char srmima[16],mima[16]="sunshibin1020";
int i=0,j;
float r,s;
while(1)
{
for(j=0;j30;j)
printf("-");
printf("\n");
printf("请输入密码:");
gets(srmima);
for(j=0;j30;j)
printf("-");
printf("\n");
if(strcmp(srmima,mima)==0)
{
printf("恭喜用c语言编写检验密码函数你用c语言编写检验密码函数,密码正确用c语言编写检验密码函数!\n");
break;
}
i;
if(i2)
{
printf("很遗憾,密码输入错误!\n");
exit(0);
}
}
area(r);
printf("圆面积为用c语言编写检验密码函数:%f",s);
getchar();
}
float area(float r)
{
float s;
while(1)
{
printf("\n请输入半径: r:");
scanf("%f",r);
if (r0)
break;
s=pi*r*r;
printf("s=%.2f\n",s);
}
exit(0);
}
c语言设计密码检测程序?#include stdio.h
#define UC(1U1)// upper case
#define LC(1U2)// lower case
#define NUM (1U3)// 0-9
#define ALL (UC|LC|NUM)
int check(const char pass1[], const char pass2[])
{
const char *p = pass1[0];
unsigned int flag = 0;
if (strlen(pass1)6 || strlen(pass1)8)
{
printf("password length is 6 to 8.\n");
return 1;
}
if (strcmp(pass1, pass2))
{
printf("the tow passwords are diffrence.\n");
return 2;
}
while (*p)
{
if (*p = 'a'*p = 'z') flag |= LC;
else if (*p = 'A'*p = 'Z') flag |= UC;
else if (*p = '0'*p = '9') flag |= NUM;
else
{
printf("in valid charactor: %c.\n", *p);
return 3;
}
p;
}
if (flag == ALL) return 0;
if ((flagUC) == 0)
{
printf("lack of uppercase.\n");
}
if ((flagLC) == 0)
{
printf("lack of lowercase.\n");
}
if ((flagNUM) == 0)
{
printf("lack of number.\n");
}
return -1;
}
int main(int argc, char *argv[])
{
char pass1[100];
char pass2[100];
do {
printf("input password:");
scanf("%s", pass1);
printf("repeat password:");
scanf("%s", pass2);
} while (check(pass1, pass2) != 0);
return 0;
}
c语言编写判断输入密码是否正确...其实啊用c语言编写检验密码函数 , 密码一般是字符串型用c语言编写检验密码函数的....建议选择字符串 。int a;
scanf("%d",a);
long a;scanf("%ld",a);
C语言中密码校验怎么做给你个参考:
#includestdio.h
#includeconio.h //用getch()函数时要的文件头
#includestring.h
#define USER "admin"
#define PWD"admin"
void main()
{
char user[20], pwd[16], ch;
int count=0, i=0;
while(count3) //3次机会输入正确密码
{
printf("user name:");
gets(user);
printf("password:");
while((ch=getch())!=13i16) //将输入的密码转换成字符****
{
putchar('*');
pwd[i]=ch;
i;
}
pwd[i]=0;
if(!strcmp(USER,user)!strcmp(PWD,pwd))
break;
else
printf("\nincorrect user name or password!\n");
count;
}
printf("\nlogin successful!\n");
}
用C语言编写一个密码验证程序#include stdio.h
#include string.h
typedef struct
{
long number; //用户编号 6位
char name[20]; //用户名
char password[8]; //用户密码
int power; //权限判断 1 为管理员2为普通用户
} user;
user yh[100]={100000,"gavin","gavine",1,100001,"wnag","wangf",2};
int length = 2;
int checkuser(long num, const char *nm, const char *pwd)
{
int i;
for (i = 0; ilength;i)
{
if (yh[i].number == num!strcmp(yh[i].name, nm)!strcmp(yh[i].password, pwd))
{
if (1==yh[i].power)
return 1;
else
return 2;
}
}
}
void main()
{
printf("%d\n", checkuser(100000, "gavin", "gavine"));
}
【用c语言编写检验密码函数 用c语言编写检验密码函数怎么写】用c语言编写检验密码函数的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于用c语言编写检验密码函数怎么写、用c语言编写检验密码函数的信息别忘了在本站进行查找喔 。

    推荐阅读