VB icon

A password program with a small difference

Email
Submitted on: 1/2/2015 6:29:00 PM
By: Shahab Faruqi (from psc cd)  
Level: Intermediate
User Rating: By 3 Users
Compatibility: C++ (general)
Views: 2137
 
     Yet another password program!! This one takes into account the backspace key, a feature which i didn't find in the other password programs on this site.
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :A password program with a small difference
//**************************************
#include<iostream.h>
#include<conio.h>
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: A password program with a small difference
// Description:Yet another password program!! This one takes into account the backspace key, a feature which i didn't find in the other password programs on this site.
// By: Shahab Faruqi (from psc cd)
//**************************************

#include<iostream.h>
#include<conio.h>
void main() 
{
clrscr();
cout<<"Enter password: \n";
restart:int x[100],x1[100],i,j=0,k=0,l;
for(i=0;i<=100;i++) 
{
shahab:l=getch();
if(((l>=48)&&(l<=126))||(l==8)||(l==13))x[i]=l;
else goto shahab;
if(x[i]==13)break; 
else if(x[i]==8) 
{
gotoxy(1,2);
clreol();
for(i=0;i<100;i++)
x[i]='\0';
goto restart;
}
else
{
cout<<"*";
k++;
}
}
cout<<"\nRe enter password: \n"; 
for(i=0;i<=k;i++) 
{
x1[i]=getche();
if(x1[i]==13)break;
}
for(i=0;i<=k;i++)
if(x[i]!=x1[i])j++; if(j==0)cout<<"\nPasswords match!!\n"; 
else cout<<"\nPasswords do not match!!\n";
getch();
}


Other 6 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.