Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string.

i becomes !
a becomes @
m becomes M
B becomes 8
o becomes .

Respuesta :

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

ACCESS MORE