Get input in c as a password field:(*****)


[** only for windows users]]

#include <stdio.h>
#include <string.h>

int main()
{
char word1[8]=”shadhin”;
char word2[8];
char c;
int i=0;
while(1)
{c=getch();
if(c==13)
{
word2[i]=”;
break;
}

word2[i]=c;
printf(“*”);
i++;

}

if(strcmp(word1,word2) == 0)
printf(“nPassword is correct”);
else
printf(“nPassword is incorrect”);
}
</code>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s