Exforsys

Free Training

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 ...

Go Back   Exforsys > Programming Talk > C and C++

Exforsys.com


C and C++ C and C++

Reply

 

LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 10-12-2009, 08:15 AM
Junior Member
 
Join Date: Oct 2009
Posts: 1
liza12 is on a distinguished road
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:


Code:
#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();
}
kindly help me..thnx in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-03-2009, 02:26 AM
Junior Member
 
Join Date: Oct 2009
Location: Bangalore, India
Posts: 2
rasmiranjanbabu is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:23 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright 2004 - 2009 Exforsys Inc. All rights reserved.