Quick actions

cmd+k|ctrl+k

Navigation

Languages

PassWordGen

Snippet info

Language

Cpp

Visibility

public

Author

krip4yk

Created

2015-07-25T20:42:31Z

Updated

2015-07-25T20:56:27Z

/*Created and Develop by
                        Krip4yk*/
/*--------------------------------------------------*/
/*This program will generated password for you and save latest pass
in .txt file. Standart string - 10 symbols, but you can change it.*/
/*--------------------------------------------------*/
#include <iostream>
#include <time.h>
#include <fstream>
#include <stdlib.h>
/*--------------------------------------------------*/
using namespace std;
/*--------------------------------------------------*/
int main()
{
 	srand(time(NULL)); //Start random generation
 	/*--------------------------------------------------*/
 	int a,b;
 	char c[10]; //You can change length of your pass, changing [10] here and
 	for (int i=0; i<10; i++) //                                             here
 	{
	 	a=rand()%3+1;
	 	switch (a)
	 	{
		    case 1:
				 {
				   	 b=rand()%10+48;
				   	 c[i]=b;
					 break;
				 } 	   
		    case 2:
				 {
     			     b=rand()%26+65;
     			     c[i]=b;
				   	 break;
				 } 	   
		    case 3:
				 {
 	   			     b=rand()%26+97;
 	   			     c[i]=b;
				   	 break;
				 } 	   
		}
	}
	/*This cycle created your password ('a-z', 'A-Z', '0-9'*/
	/*--------------------------------------------------*/
 	ofstream fo;
	fo.open("YourPassWordGen.txt");
	for (int i=0; i<10; i++)
	{
	 	fo << c[i];
	}
	fo.close();
	/*Then your pass write in .txt file*/
	/*--------------------------------------------------*/
	for (int i=0; i<10; i++)
	{
	 	cout << c[i];
	}
	cout << "\nYour PassWord Generated in 'YourPassWordGen.txt' file.\n";
	/*And you can see your pass in console (this site, only here)*/
	/*--------------------------------------------------*/
	return 0;
}
/*P.S. - If you work in Dev-C++ v4.9.9.2, you must add this line 'system("pause");' between 59-60 lines
  P.P.S. - If you work in Visual Studio, i can't garanted working it code.*/
INFO