如何实现用户输入用户名?
代码示例:
#include
#include
void
main()
{
int
i=0;
while(i<3)
{
printf(
"输入用户名bai:");
char
name[10],psw[10];
scanf("%s",name);
printf("输入密码:");
scanf("%s",psw);
if((strcmp(name,"abc")==0)&&(strcmp(psw,"123456"))==0)
{
printf("welcome
to
use
the
software\n");
break;
}
i++;
}
if(i>=3)
{
printf("password
error!you
can
not
use
software\n");
}
}