2个回答
展开全部
#include<stdio.h>
#include<string.h>
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++;
}
}
}
#include<string.h>
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++;
}
}
}
展开全部
#include "stdio.h"
#include<string.h>
#include<bios.h>
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次的话自己加个循环哈;
呵呵
#include<string.h>
#include<bios.h>
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次的话自己加个循环哈;
呵呵
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询