用C语言程序编写用户名密码 程序
答案:2 悬赏:80
解决时间 2021-01-12 23:34
- 提问者网友:流星是天使的眼泪
- 2021-01-12 09:59
用C语言程序编写用户名密码 程序
最佳答案
- 二级知识专家网友:执傲
- 2021-01-12 10:10
#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++;
}
}
}
#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++;
}
}
}
全部回答
- 1楼网友:梦中风几里
- 2021-01-12 10:42
#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次的话自己加个循环哈;
呵呵
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯