2014/3/12 2014/3/12

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

int main()

{

char a[200]="password1";

char b[200]="password2";

char c[200];

int t,time=0,time1=0,g=0;

while(gets(c))

{

if(strcmp(c,a)==0)

{

time1++;

}

if(strcmp(c,b)==0)

{

time1++;

}

if(time1!=0)

{

printf("輸入正確\n");

time=0;

time1=0;

}

else

{

printf("輸入錯誤,請再次輸入:\n");

time++;

   time1=0;

}

if(time==3)

{

printf("錯誤超過3次,終止程式\n");

g=1;

break;

}

if(g==1)

break;

}

system("pause");

return 0;

}