Tuesday 4 December 2012

strcmp | How to check password in C with Break Statement and while


I don't have so much idea about its execution but at last its using strcmp to compare
original password and entered password by using f7 key you can get its idea .

#include<stdio.h> //initializing header files
#include<conio.h>
void main()
{
void pass();  // function name pass
clrscr();
pass();
printf("\n\nNow you can proceed...........\n");
getch();
}
void pass()
{
char ar[30],ch; //
int i=0;
printf("\n\nEnter password\n");
while(1)
{
ch=getch();
if(ch==13)
break;
else
{
ar[i]=ch;
i++;
printf("*");
}
}
ar[i]='\0';
if(strcmp(ar,"yourvalue")==0)
return;
else
{
printf("Invalid password try again\nPress any key to continu\n");
getch();
pass();
}
}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: