Password Checks 3 times Problem
Hey guys I'm a newbie in C programming and I had a hard time trying to figure out whats the problem with my codes:
Code:
#include <stdio.h>
#include <string.h>
main()
{
char pass1[20];
char pass2[]= "password";
int i=0;
do
{
i++;
clrscr();
printf("Enter Password: ");
gets(pass1);
if(strcmp(pass1,pass2)==0)
printf("Congrats!");
else
printf("Invalid Password %i Tries\n");
}
while((strcmp(pass1,pass2)!=0 || i!=3);
getche();
}
This codes suppose to check password entered if it matches the given. If it is incorrect the loop will not terminate till one of the conditions below is satisfied... Help me out guys... Thanks in advance...