#include<string.h>
main()
{int cs=0
int pw=8888
int lr
printf('Please enter the password:)
scanf(%d,lr)
while(cs<3)
{if(lr=pw)
{printf('You are welcome!')
cs=3}
else
{printf('\nWrong passward!\n')
cs++
printf('Enter again:\n')
scanf(%d,lr)
}
if(lr!=pw)
{printf('You have entered three times! You are not welcom!')
}}
试一下吧!
#include <stdio.h>#include <string.h>
int main( )
{
int t = 3
char psw[50]="hello"
char pass[50]
while(t--)
{
gets(pass)
if(strcmp(psw, pass) == 0)
{
puts("登录成功")
break
}
else printf("登录失败,你还有%d机会\n", t)
}
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)