为什么会超时!!!!!!!!!!
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int strcompare(char str1[],char str2[])
{
int i=0;
while(str1[i]==str2[i] && str1[i]!=0 && str2[i]!=0
)
i++;
return str1[i]-str2[i]; }
int main()
{ char password[20]="hnkd2011"; char input_pass[20];
int i=0;
while(1)
{ printf("Input password\n");
gets(input_pass);
if(strcompare(input_pass,password)!=0)
printf("Error,please input again!");
else break;
getch();
i++;
if(i==3)
printf("The program is terminated!");
exit(0); }
printf("congratulation!");
return 0; }
我想问下他为什么会超时,而当把getch去了,再
i++;
if(i==3)
printf("The program is terminated!");
exit(0); }改成
if(i==2)
{ printf("The program is terminated!");
exit(0); }
i++;},其中i改成二就不会超时了呢,两者好像没什么区别把?希望谁知道的告诉我下