#include<iostream.h>
#include<conio.h>
void main()
{
char str[25],pass[25];
int i;
clrscr();
cout<<""\nEnter username"";
cin>>str;
cout<<""\nEnter password:"";
cin>>pass;
for(i=0;pass[i]!='\0';i++)
{
if(pass[i]=='i')
pass[i]='!';
if(pass[i]=='a')
pass[i]='@';
if(pass[i]=='m')
pass[i]='M';
if(pass[i]=='B')
pass[i]='8';
if(pass[i]=='o')
pass[i]='.';
if(pass[i+1]=='\0')
pass[i]='*';
}
cout<<""\nUsername: ""<<str<<endl;
cout<<""\nPassword now is: ""<<pass<<endl;
getch();
}
Explanation:
Here, the user is asked to enter his/her username and password. Since the user-generated passwords are easy to interpret and hack able, this program will accept the password and change it so to increase the password strength,(in other words, encrypting it). It uses a key such that whenever a letter is encountered, it is replaced by its subordinate in the key. Then the programs also appends at end of input string. It’ll show the changed password to the user on the screen.