
- Forum
- Programming Talk
- C and C++
- how to make the password in to asterisk and asign a exact password for char.
how to make the password in to asterisk and asign a exact password for char.
This is a discussion on how to make the password in to asterisk and asign a exact password for char. within the C and C++ forums, part of the Programming Talk category; uhm.... excuse me but can you please help me? i'm having trouble with making password in TURBO c.... the condition ...
-
how to make the password in to asterisk and asign a exact password for char.
uhm.... excuse me but can you please help me? i'm having trouble with making password in TURBO c.... the condition goes like this, while the user is entering a password, the user will not see alpha-numeric characters instead, he/ she can see only asterisk... and the computer will read the password.
if the password is 'liza' it will clear the screen and it will loading...if it`s not it will print 'failed to log-in'
can you please tell me the code?????
my only problem is how to asign password and the computer or the program will read the password
here`s my code:
kindly help me..thnx in advanceCode:#include<conio.h> #include<stdio.h> main() { char *ptr; char pwd[150]; char c; int a,x; int i=0; char password[15]; clrscr(); printf("ENTER PASsword"); while(1) { gets(password); x=strcmp(password, "liza"); c=getch(); if(c==13) { pwd[i]=NULL; break; } printf("*"); pwd[i++] = c; } if(x!=0) { printf("FAILED TO LOG-IN"); } clrscr(); for(a=1;a<=80;a++) { gotoxy(a,1);printf("\xDB"); gotoxy(a,24);printf("\xDB"); delay(990); gotoxy(37,13);printf("LOADING!!!"); } getch(); }
-
11-03-2009, 01:26 AM #2
- Join Date
- Oct 2009
- Location
- Bangalore, India
- Answers
- 2
Check it out
I have run this code in VC++ 6.0.
It works. Please check it out.
#include<conio.h>
#include<stdio.h>
#include<string.h>
//#include<graphics.h>
main()
{
int c;
int i;
char pwd[80];
// clrscr();
printf("ENTER PASsword");
for ( i = 0; i < 79 && (c = getch()) != '\r'; ++i )
{
pwd[i] = c;
putch('*');
}
pwd[i] = '\0';
printf("\n");;
if ( strcmp(pwd, "liza") == 0 )
{
printf("Correct \n");
}
else
{
printf("INCorrect \n");
}
return 0;
}
I hope this helps you

Reply With Quote





