程序漏洞在哪 找不到原因了 求帮忙
[local]1[/local]main()
{
char *password[]=
{"Cat","Mouse","Dog","Sugar","Water","Meat","Steel"};
char mima[100];
int num,count=0;
scanf("%d",&num);
gets(mima);
while(count<2)
{
if(strcmp(mima,password[num-1])==0)
{printf("It's right!welcome...");break;}
else
{printf("please input password again:");
gets(mima);
count++;
}
if(count==2)
printf("error");}
getch();
}
为什么运行时输错两次 第三次就算输对了 结果也是“error” 其他情况都没问题