Wednesday 30 January 2013

How to hidden Password



This short Program was written in objective to show you how can we convert entered character in to asterix(*), This technique is mostly used for password where we want to hide passwords.


About Code:


This program is written compiled and tested in visual Studio 2010, if you want to use it in other compiler remove "stdafx.h" header file and also remove using name space std; line

In this code we use password-1 in if condition to check the last entered number is enter or not using -1 because we incremented the counter variable in last step of program.

123456789101112131415161718
#include "stdafx.h"
#include "iostream"
#include "conio.h"
using namespace std;
 
 
int main()
{
char password[20];int i=0;
cout<<"Enter Password";
while(password[i-1]!='\r')
{
password[i]=getch();
cout<<"*";
i++;
}
return 0;
}

No comments:

Post a Comment