为什么printf会显示两次
代码:#include<stdio.h>
int main()
{
char user='z',user1;
int password=123,password1,n=0;
do
{
printf("请输入用户名和密码:");
scanf("%c,%d",&user1,&password1);
if(user1=='z'&&password1==123)
{
printf("您输入正确,请登录!");
n=4;
}
else
{
printf("您输入有误,请重新输入\n");
n++;
}
}
while(n<4);
return 0;
}
结果
请输入用户名和密码: p, 123
您输入有误,请重新输入
请输入用户名和密码: p, 123
您输入有误,请重新输入
请输入用户名和密码:您输入有误,请重新输入
请输入用户名和密码: p, 123
您输入有误,请重新输入
Press any key to continue

