Sleep(毫秒)对应#include《Windows.h》的头文件,意思是延迟显示
system(“cls”);清除屏幕;对应stdlib.h的头文件
int main()
{
int i;
char password[20] = { 0 };
for (i = 0; i < 3; i++)
{
printf("输入密码:>");
scanf("%s", &password);
//if (password == "123456")//不能使用==来比较字符串,应该用库函数strcmp
if(strcmp(password,"123456")==0)
{
printf("yes\n");
break;
}
else {
printf("err\n");
}
}
if (i == 3)
{
printf("err\n");
}
return 0;
}