Last active
November 14, 2016 04:41
-
-
Save Parassharmaa/576d58712aece382b0c207bb92f5e4c0 to your computer and use it in GitHub Desktop.
Cpp program to generate random password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
#include <ctime> | |
using namespace std; | |
char rand_char(); | |
int main() { | |
srand((int) time(0)); | |
int n; | |
cout<<"Enter length of password:"; | |
cin>>n; | |
for (int i=0;i<5;i++) { | |
for (int j=0; j<n;j++) { | |
cout<<rand_char(); | |
} | |
cout<<endl; | |
} | |
return 0; | |
} | |
char rand_char() { | |
return(char(rand()%(122-97)+97)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it is too easy