Coders Packet

Random Password Generator in C++

By Shivangi Singhal

A random password generator using C++, which lets you make a password of desired length.

The code shown below is the code of a random password generator in C++.The code takes as input a number from the user, of how much length password user wants to create, and then creates the password of the desired length, given by the user.

The password is generated using srand() function, which is a a function of library. The function srand() is used to generate the random integers based on the user's requirement. Here the requirement of the user is the number of characters he wants in the password, so srand() function, will generate random integers based on the input by the user.

A library of is used, for the time function, which is initialized by NULL or 0.

The code then inputs the 'yourlength' from the user, and the runs the loop 'yourlength' number of times, to generate a random password.

As rand() function is used, the password generated, everytime, will be unique.

Finally the password is printed as the output to the user.

Download Complete Code


No comments yet