41+ CPP Password Generator Examples

This post contains a total of 41+ Hand-Picked C++ Password Generator Examples. All the Password Generator are made purely using C++ Programming Language.

You can use the source codes of these C++ Password generators for educational use with credit the original owner, if you want to use the source codes for some other use then you can contact the original owner for it.

Related Posts

Click a Code to Copy it, and Hover over a video to play it.

1. By SoloLearn

Made by Sololearn. Randomly generates a 8 digits password that contains number, symbols and alphabets. ( Source )

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

static const char alphanum[] =
"0123456789"
"[email protected]#$%^&*"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
int size = sizeof(alphanum) - 1;

int main()
{
	//password length
	int length = 8;
	
	srand(time(0));
	for (int i = 0; i < length; i++)
	{
		cout << alphanum[rand() % ::size];
	}
	return 0;
}

2. By Amit Mathew

C++ Password generator by Amit Mathew. You have to enter the length of the password that you need and the program will print out a random password with symbols, digits and alphabets. ( Source )

/*The logic behind random strings is derived from http://www.cplusplus.com/forum/windows/88843/*/
/*Edited and Modified by-Amit Mathew*/
/*Don,t forget to upvote the code if you liked it!,πŸ˜‰*/

#include<iostream>
#include<cstdlib> 
#include<ctime> 
using namespace std; 
static const char alphnum[]="0123456789" "[email protected]#$%^&*" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"; 
int strLen=sizeof(alphnum)-1; 
char GenRand()
{ 
 return alphnum[rand()%strLen]; 
} 
 int main() 
 { 
  int n,c=0,s=0;
  srand(time(0));
  cout<<"Enter the length of the password required:";
  cin>>n;
  cout<<n<<endl;
  cout<<"Your Password is:";
  N:
  char C;
  string D;
  for(int z=0; z < n; z++) 
   { 
     C=GenRand();
     D+=C;
     if(isdigit(C))
     {
         c++;
     }
    if(C=='!' || C=='@' || C=='$' || C=='%' ||  C=='^' || C=='&'|| C=='*'|| C=='#')
    {
        s++;
    }
   }
   if(n>2 && (s==0 || c==0))
   {
      goto N; 
   }
   cout<<D; 
   cout<<endl<<endl<<"                 THANK YOU";
   return 0; 
}

3. By Madhav

Made by Madhav. Enter the password length you need to get the desired random password. ( Source )

//Code by Madhav ☺️


#include <iostream>
#include <cstdlib>
#include <ctime>

//Nothing of importance
void ATag();

int main() 
{

//Nothing of importance
 ATag() ;

int x,n,i;
srand(time(0));
char  a[]={"0123456789"
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        "abcdefghijklmnopqrstuvwxyz"
        "[email protected]#$%^&*?_:"};
n=8;
std::cin>>n;    

if(n<8||n>32)
{
    std::cout<<"ERROR: Password length has  be to between 8 to 32 .";
    return 0;
}
std::cout<<"Password strength : ";
std::cout<<n<<" .\n\n";
std::cout<<"=>Your Password : ";
       
x=sizeof(a)-1;

for(i=1;i<=n;i++)
{
    std::cout<<a[(rand()%x)];
}

    return 0;
}

//Nothing of importance
void ATag(){int ATag[]={45,0,66,121,0,77,97,100,104,97,118};for(int i=0;i<11;i++){(ATag[i]==0)?std::cout<<" ":std::cout<<char(ATag[i]);}std::cout<<"\n\n";}

4. By _Aysha_

Made by Aysha. Generates a random 8 digits password. ( Source )


#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;
static const char password[] =

"0123456789"
"[email protected]#$%^&*"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";

int size = sizeof (password)- 1;
int main()

{

//password length

int length = 8;
srand(time(0));
cout<<" Your randomly Generated Password is:"<<endl;
for (int i = 0; i < length; i++)

{
cout << password[rand() % ::size];
}
return 0;
}

5. By JoΓ£o Fernandes

Made by JoΓ£o Fernandes. Enter the password length first, the program will generate the random password and will print out whether the password is weak or strong. ( Source )

#include <iostream>
#include <stdlib.h> 
#include <time.h>
using namespace std;

// This is my first c++ posted code! 

int main() {
    srand(time(0));
    
    char alphabet[] = "[email protected]#$%&*?_:";
    char password[] = {};
    int maxNumb = sizeof(alphabet) - 1;
    int lenght = 8;
    cout << "Password lenght: ";
    cin >> lenght;
    if (lenght >= 8 && lenght <= 32) {
        for (int x = 0; x < lenght; x++) {
             password[x] = alphabet[(rand() % maxNumb)];
             cout << password[x];
        }

    }
    else {
        cout << "Error! Password must be between 8 to 32 characters \n";
    }
    
    char lower[] = "abcdefghijklmnopqrstuvwxyz";
    char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    char number[] = "0123456789";
    char symbol[] = "[email protected]#$%&*?_:";
    
    cout << "\n" << "Password strength: ";
    bool haslower = false;
    bool hasupper = false;
    bool hasnumber = false;
    bool hassymbol = false;
    
    for (int y = 0; y < lenght; y++) {
        if (password[y] == lower[0] || password[y] == lower[1] || password[y] == lower[2] ||password[y] == lower[3] ||password[y] == lower[4] ||password[y] == lower[5] ||password[y] == lower[6] ||password[y] == lower[7] ||password[y] == lower[8] ||password[y] == lower[9] ||password[y] == lower[10] ||password[y] == lower[11] ||password[y] == lower[12] ||password[y] == lower[13] ||password[y] == lower[14] ||password[y] == lower[15] ||password[y] == lower[16] ||password[y] == lower[17] || password[y] == lower[18] ||password[y] == lower[19] ||password[y] == lower[20] ||password[y] == lower[21] ||password[y] == lower[22] ||password[y] == lower[23] ||password[y] == lower[24] ||password[y] == lower[25]) {
            haslower = true;
        }
        else if (password[y] == upper[0] || password[y] == upper[1] || password[y] == upper[2] ||password[y] == upper[3] ||password[y] == upper[4] ||password[y] == upper[5] ||password[y] == upper[6] ||password[y] == upper[7] ||password[y] == upper[8] ||password[y] == upper[9] ||password[y] == upper[10] ||password[y] == upper[11] ||password[y] == upper[12] ||password[y] == upper[13] ||password[y] == upper[14] ||password[y] == upper[15] ||password[y] == upper[16] ||password[y] == upper[17] || password[y] == upper[18] ||password[y] == upper[19] ||password[y] == upper[20] ||password[y] == upper[21] ||password[y] == upper[22] ||password[y] == upper[23] ||password[y] == upper[24] ||password[y] == upper[25]) {
            hasupper = true;
        }
        else if (password[y] == number[0] || password[y] == number[1] || password[y] == number[2] ||password[y] == number[3] ||password[y] == number[4] ||password[y] == number[5] ||password[y] == number[6] ||password[y] == number[7] ||password[y] == number[8] ||password[y] == number[9]) {
            hasnumber = true;
        }
        else if (password[y] == symbol[0] || password[y] == symbol[1] || password[y] == symbol[2] ||password[y] == symbol[3] ||password[y] == symbol[4] ||password[y] == symbol[5] ||password[y] == symbol[6] ||password[y] == symbol[7] ||password[y] == symbol[8] ||password[y] == symbol[9]) {
            hassymbol = true;
        }
    }
    
    int ticks = 0;
    if (haslower) {
        ticks += 1;
    }
    if (hasupper) {
        ticks += 1;
    }
    if (hasnumber) {
        ticks += 1;
    } 
    if (hassymbol) {
        ticks += 1;
    }

    
    switch (ticks) {
        case 1:
        cout << "weak";
        break;
        case 2:
        cout << "medium";
        break;
        case 3:
        cout << "strong";
        break;
        case 4:
        cout << "very strong";
        break;
        default: "Error";
        break;
    }
}
// made by JoΓ£o Fernandes

6. By Sofija

Made by Sofija. Enter password length for random password. ( Source )

/*
 Enter wanted length and generate your password
*/

#include<iostream>
#include<vector>
#include<cstdlib>
#include<ctime>
int main()
{
    srand(time(NULL));
    int size;
    std::vector<int> password;
    char chars[73]={'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m','Q','!','$','@','_','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M','1','2','3','4','5','6','7','8','9','0','!','@','#','$','%','&'};
    std::cout << "Enter size for your password: ";
    std::cin >> size;
    for(int i = 0; i < size; i++)
        password.push_back(chars[rand()%69]);

    std::cout << "\nYour password is: ";
    for(char p : password)
        std::cout << p;
}

7. By Shimon

Made by Shimon. Enter password length you want and the random password. ( Source )

//enter a length of the password
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main() {
srand(time(0));
string chars = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
int i;
int c = chars.length();
int Input;
cin >> Input;
cout << "Your Password:" << endl;
while(i < Input){
	cout << chars[rand() % c];
	i++;
}
	return 0;
}

8. By Anton

Made by Anton. The program generates 5 random passwords that are 12 digits in length. ( Source )

#include <iostream>
#include <cstdlib>    
#include <ctime>
  
using std::cout;
using std::cin;
using std::endl;
 
#define sym "QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm"

void comment();
void generate();

int main () {   
    srand(time(NULL));
    generate();
    comment();
    return 0;
}   

void generate(){
    char password[12];
    srand(time(0));
    
    for(int x(0); x < 5; x++)
    {
        cout << "Your password[#" << x+1 << "]: ";
        //↓↓↓↓↓Generate password↓↓↓↓↓
        for(int x(0); x <= 11; x++)
        {
            password[x] = sym[rand() % 56];
            cout << password[x];
        } 
        //^^^^^^^^^^^^^^^^^^^^^^^^^^  
        cout << endl;
    } 
}

void comment(){
    for(int x(0); x<=4; x++)
    {  
        cout << endl;
        for(int x(0); x<=5; x++)
        {
            cout << "V "; 
        }
    } 
    cout << "\n\nIf you like then press '^':) "; 
} 

9. By Zakhar Tsvirko

Basic C++ Password Generator by Zakhar Tsvirko. It generates a random 12 digit password that contains, numbers, symbols and alphabets. ( Source )

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int main() 
{
    string S = "[email protected]#$%^&*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    
    int length = 12;
    
    srand(time(0));
    
    cout << "The generated password : ";
    
    for(int i = 0; i < length; i++)
    {
        cout << S[rand() % S.size()];
    }
    
    cout << "\n\n";
    
    cout << "If you like it, please hit one like :)";
    
    return 0;
}

10. By Nautash Ahmad

Made by Nautash Ahmad. Min password length is 8 digits, and max is 32. Enter the password length to get a random password. ( Source )

/*******************************************

Author: Nautash Ahmad
Created: 16th January, 2019

*******************************************/
#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>
using namespace std;

int main() {
    int arrSize = 94;
    char printableAscii[94] = "\0";

    for(int i = 33, j = 0; i < 127; i++)
        printableAscii[j++] = (char)i;
        
    int len = 0;
    cout << "Enter the length of the password: ";
    cin >> len;
    
    if(len < 8) {
        cout << "\nMinimum password length should be at least 8-characters long\n";
        return 0;
    }
    else if(len > 32) {
        cout << "\nPassword length should not exceed more than 32-characters\n";
        return 0;
    }
        
    srand(time(NULL));
    string password = "";
    
    for(int i = 0; i < len; i++) {
        int randomNum = rand() % (93 - 0 + 1) + 0;
        password += printableAscii[randomNum];
    }
    
    cout << "\nYour randomly generated password: " << password << endl;
    cout << "Password length: " << len << endl;
    
    return 0;
}

11. By _Sau_rab_h_

Made by Sau_rab_h. Enter password length between 1 – 10 for a random password. ( Source )

//enterbthe length of password which you want 1-10
#include <iostream> 
#include <cstdlib> 
#include <ctime> 
using namespace std; 
static const char alphnum[]="0123456789" "[email protected]#$%^&*" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz";
 int strLen=sizeof(alphnum)-1;
  char GenRand() {
   return alphnum[rand()%strLen];
    } int main() { 
    int n,c=0,s=0; 
    srand(time(0));
     cout<<"Enter the length of the password required:"; 
     cin>>n; 
     cout<<n<<endl;
      cout<<"Your Password is:"; 
      N: char C; 
      string D; 
      for(int z=0; z < n; z++) {
       C=GenRand(); 
       D+=C; 
       if(isdigit(C)) { 
       c++; 
       } 
       if(C=='!' || C=='@' || C=='$' || C=='%' || C=='^' || C=='&'|| C=='*'|| C=='#') { 
       s++; 
       } 
       }
        if(n>2 && (s==0 || c==0)) { 
        goto N; 
        } 
        cout<<D; return 0; 
        }

12. By Mayank Rungta

Made by Mayank Rungta. The password generator shows the reverse alphabet of the input, so if you enter for example ‘password’, the program will output it as ‘kzhhdliw’ which if you enter in the password generator again then you will get ‘password’ output. Its like encrypting your passwords in a different language or something. ( Source )

//hello guys i am Mayank Rungta//
/*this program shows the reverse alphabet of input"*/
//as a password//
//example:a=z//
#include <iostream>
using namespace std;
int main()
{
    int count = 0, c, e = 96, count1 = 0, j = 123;
    string sentence, alphabet[50];
    //taking input//
    getline(cin, sentence);
    //make all capital letter into smaller letter//
    for (int b = 0; sentence[b] != '\0'; b++)
    {
        c = sentence[b];
        count1 = 0;
        if (c > 64 && c < 91)
        {
            for (int d = 'A'; d <= 'Z'; d++)
            {
                if (c == d)
                {
                    count++;
                    break;
                }
                else
                {
                    count++;
                }
            }
        }

        if (count > 0)
        {
            sentence[b] = e + count;
        }
        count = 0;
    }
    // here,i change input to reverse alphabet //
    for (int f = 0; sentence[f] != '\0'; f++)
    {
        c = sentence[f];
        count1 = 0;
        j=123;
        if (c > 96 && c < 123)
        {
            for (int a = 'a'; a <= 'z'; a++)
            {
                if (a == c)
                {
                    count1++;
                    break;
                }
                else
                {
                    count1++;
                }
            }
        }
        if (count1 > 0)
        {
            j = j - count1;
            sentence[f] = j;
        }
    }
    cout << sentence;
}

13. By Shehab Habila

Made by Shehab Habila. Enter password length for random password, there is no limit to the password length. ( Source )

// Created by Shehab habila

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
srand(time(0));
string v = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789" "@&$?#%!~";
int x,y;
cin>>y;
int d = v.length();
while(x < y){
    cout << v[rand() % d];
    x++;
}
    cout<<"\n\nupvote my code!";
    return 0;
}

14. By kakodum

Made by kakodum. Enter password length to get the random password that uses only numbers and alphabets, no symbols. ( Source )

#include <iostream>
#include <cstdlib>
#include <ctime>
//enter the number of characters in the password
using namespace std;

int main() {
srand(time(0));
string a = "qwertyuiopasdfghjklzxcvbnm1234567890Q1W2E3R4T5Y6U7I8OP9ASDFGHJKLZXCVBNM";

int b;
cin >> b;
for(int d = 0; d < b; d++)

	cout<<a[rand()% 74-1];

	return 0;
}

15. By Ufnhel

C++ Password Generator by Ufnhel. It generates random passwords with random length and random numbers, symbols and alphabets. ( Source )

#include <iostream>
#include <ctime>
#include <string>

//This is password generator
//I have nothing to say ahah

//Like it, please ^_^

using namespace std;

int main() 
{
    srand(time(NULL));
    
    string symbs = "abcdefghijklmnopqrstuvwxyz";
    string numbers = "0123456789";
    string special = "@#_";
    
    int symbsS = 1 + rand() % 15;
    int numbersS = 1 + rand() % 10;
    int specialS = 1 + rand() % 3;
    
    int syloc = rand() % 27;
    int nuloc = rand() % 11;
    int sploc = rand() % 4;
    
    int passize = symbsS + numbersS + specialS;
    int p = passize;
    int inpassloc = rand() % p;
    
    string aboba[passize];
    int temppassloc = 0;
    int tempsyloc = 0;
    int tempnuloc = 0;
    int tempsploc = 0;
    
    for(int i = 0; i < symbsS; i++) {
        
        aboba[inpassloc] = symbs[syloc];
        temppassloc = rand() % p;
        
        for(int i = 0; i < 30; i++) {
            
            if(temppassloc != inpassloc) {
                
                break;
            }
            
            else {
                
                temppassloc = rand() % p;
                
            }
            
        }
        
        inpassloc = temppassloc;
        tempsyloc = rand() % 27;
        syloc = tempsyloc;
        
    }
    
    for(int i = 0; i < numbersS; i++) {
        
        aboba[inpassloc] = numbers[nuloc];
        
        temppassloc = rand() % p;
        
        for(int i = 0; i < 30; i++) {
            
            if(temppassloc != inpassloc) {
                
                break;
                
            }
            
            else {
                
                temppassloc = rand() % p;
                
            }
            
        }
        
        inpassloc = temppassloc;
        
        tempnuloc = rand() % 11;
        
        nuloc = tempnuloc;
    }
    for(int i = 0; i < specialS; i++) {

        aboba[inpassloc] = special[sploc];

        temppassloc = rand() % p;
        
        for(int i = 0; i < 30; i++) {
            if(temppassloc != inpassloc) {
                break;
            }
            else {
                temppassloc = rand() % p;  
            }
        }
        
        inpassloc = temppassloc;
        tempsploc = rand() % 5;
        sploc = tempsploc;
    }
    for(int i = 0; i < passize; i++) {
        cout << aboba[i];
    }
    return 0;
}

16. By Dawid

Made by Dawid. You have the option to generate strong, very strong and super strong password, you get the option to choose one of the option of how secure password you want to generate. ( Source )

//created by dawid 19 jan 2019;
//updated jan 20; 2019
//correction by Jonathan Pizarra
//Working

#include <iostream>
#include <string>
#include <cmath>
#include <stdlib.h>
#include <cstdlib>
#include <ctime>
using namespace std;

int main() {

	srand(time(0));
	
	string str= ("qwertzuioplkjhgfdsayxcvbnmQWERTZUIOPLKJHGFDSAYXCVBNM1234567890!?&€/;|&+*%#_~");
	   std::cout<< "Welcome to Dawid's PW		generator.\n\n"<<
	   "Select from the options below: \n"<<
	   "1. Generate a strong PW.\n"<<
	   "2. Generate a very strong PW.\n"<<
	   "3. Generate a super strong PW.\n"<<endl;
		
		int x;
		cin>>x;
		switch(x){
		case 1:
		
		std::cout<<"\nYour PW: ";
		for(int i=0; i<8; i++){
			std::cout<<str[rand()%str.length()];}
   break;
		case 2:
		std::cout<<"\nYour PW: ";
		for(int i=0; i<16; i++){
			std::cout<<str[rand()%str.length()];}
   break;
		case 3:
		std::cout<<"\nYour PW: ";
		for(int i=0; i<32; i++){
			std::cout<<str[rand()%str.length()];}
   break;
	default:
	std::cout<< "ERROR! Please enter a number between 1 and 3."<<endl;
}
	return 0;
}

17. By CarrieForle

Made by CarrieForle. Enter the passwords length for the random password. The program also prints out whether the passwords contains symbol, alphabet and numbers or not. ( Source )

#include <iostream>
#include <ctime>

using namespace std;

int main() {
    /////Customizable/////
    bool alpha = true;      //Alphabet will be included in the password.
    bool n     = true;      //Numbers will be included in the password.
    bool sym   = true;      //Symbols will be included in the password.
    //////////////////////

    const char alphabet[] = {"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"};
    const char nums[] = {"0123456789"};
    const char symbols[] = {"[email protected]#$%^&*()_-=+[]{};:\'\"\\./<>`~,"};
    bool *ptr=NULL;

    const short int ae = sizeof(alphabet);
    const short int ne = sizeof(nums);
    const short int se = sizeof(symbols);

    srand(time(NULL));
    int l;

    try {
        const short int check = alpha+n+sym;
        cin >> l;

        if(!check)
            throw 0;
        if(!l)
            throw 1;
        char pass[l];

        for (int i=0 ; i<l ; i++) {
            switch(check) {
            case 3:
                pass[i]=33+rand()%94;
                break;

            case 2:
                ptr = &(!alpha ? alpha : (!n ? n : sym));
                if(ptr == &alpha)
                    pass[i] = rand()%2 ? nums[rand()%ne] : symbols[rand()%se];
                else if (ptr == &n)
                    pass[i] = rand()%2 ? alphabet[rand()%ae] : symbols[rand()%se];
                else
                    pass[i] = rand()%2 ? alphabet[rand()%ae] : nums[rand()%ne];
                break;

            case 1:
                pass[i]= alpha ? alphabet[rand()%ae] : (n ? nums[rand()%ne] : symbols[rand()%se]);
                break;
            }
        }

        cout << "Length: " << l << "\nAlphabet: " << boolalpha << alpha << "\nNumbers: " << n << "\nSymbols: " << sym << "\n\n";
        cout << "Your password: ";
        for(int i=0 ; i<l ; i++)
            cout << pass[i];
    }

    catch(int i) {
        cout << "ERROR! ";
        switch(i) {
        case 0:
            cout << "At least one option must be true.";
        case 1:
            cout << "Invalid input. The input must be an integer and greater than 0.";
        }
    }
    return 0;
}

18. By Oskarr

Made by Oskarr. Enter password length for a random password. ( Source )

#include <iostream>
#include <time.h>
#include <cstdlib>
using namespace std;

int main() {

    int a;
    cin>>a;
    
    srand(time(NULL));
    char z;
    for(int i=0;i<a;i++)
    {
        z=char(rand()%93+34);
        cout<<z;
    }
    return 0;
}

19. By Filip

Made by Filip. Enter password length for a random password that always starts with letter. ( Source )

#include <iostream>
#include <cstdlib>
#include <ctime> 
#include <cctype>

using namespace std;
void randPass(int);
int main() {
    srand(time(0));
    
    //length of the password
    int length;
    cin>>length;
    randPass(length);
    return 0;
}

void randPass(int length) {
   char characters[length];
   for(int i=0; i<sizeof(characters); i++) {
      characters[i] = 33 + rand() % 94;
   }
   //Let's begin your password with a letter 
   if(!isalpha(characters[0]))
       characters[0] = 97 + rand() % 26;
   for(int j=0; j<sizeof(characters); j++)
       cout<<characters[j];
}    

//Made by Filip [17.01.2017] [DD.MM.YYYY]

20. By Andrea Simone Costa

Made by Andrea Simone Costa. Enter password length between 1 – 100 to get a random password. The password is also saved to a password.txt file. ( Source )

#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>

using namespace std;

inline void initializeSrand() { srand(time(NULL)); }

int takeLenght()
{
    int lenght = 0;
    do
    {
        cout << "Insert password's lenght (3 - 100)" << endl;
        cin >> lenght;
    }while((lenght < 3)||(lenght > 100));
    return lenght;
} 

char randomLetter()
{
    char letters[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    return letters[rand()%52]; // from 0 to 51 because 52 is /0
}

char randomDigit()
{
    char digits[11] = "0123456789";
    return digits[rand()%10]; // from 0 to 9 because 10 is /0
}

char randomSpecial()
{
    char specials[13] = "![]{}()$=%&?";
    return specials[rand()%12]; // from 0 to 11 because 12 is /0
}

char randomCharacter()
{
    unsigned short int n = rand()%3; // from 0 to 2
    switch(n)
    {
        case (0): return randomLetter(); break;
        case (1): return randomDigit(); break;
        case (2): return randomSpecial(); break;
        default: return ' '; break;
    }
}

char* generatePassword(int lenght)
{
    char* password = new char[lenght];
    password[0] = randomDigit(); // first might be a number
    
    int n = rand()%2; // from 0 to 1
    if(n) { password[1] = randomLetter(); password[2] = randomSpecial(); } // at least one letter and one special character
    if(!n) { password[1] = randomSpecial(); password[2] = randomLetter(); } // at least one special character and one letter
    
    for(int i = 3; i < lenght - 1; i++) password[i] = randomCharacter();
    password[lenght - 1] = 0;
    return password;
}

int main(int argc, char *argv[])
{
    initializeSrand();
    int lenght = takeLenght() + 1;
    const char* password = generatePassword(lenght);
    cout << password << endl;
    
    fstream PasswordFile;
    PasswordFile.open("password.txt",ios::app);
    PasswordFile << password << endl;
    PasswordFile.close();
    return 0;
}

21. By Sachin

A basic C++ Password Generator by Sachin. It generates a random 10 digit password that contains numbers, symbols and alphabets. ( Source )

/*Everytime Password will be Randomized 
Keep running till u find u'r fav 1!!...*/

#include <iostream>
using namespace std;

int main() {
srand(time(NULL));
string P,s;
int k=0;
     for(int i=0;i<10;i++) {
         k=rand()%4;
switch (k) {
      case 0 : s=65+rand()%25;
                P=P+s;
               break;
      case 1 : s=98+rand()%25;
                P=P+s;
               break;
      case 2 : s=49+rand()%9;
                P=P+s;
               break;
      case 3 :s=(33+rand()%11 < 60+rand()%6) ? 33+rand()%11 : 60+rand()%6;
                P=P+s;
               break;
         }
    }
                    
cout<<"Generated PassCode\t Β¬>\t "<<P;
  
 return 0;
}

22. By Avadh Patel

Made by Avadh Patel. It generates a 16 digit random password which contains numbers, alphabets and symbols. ( Source )

#include <iostream>
using namespace std;
static const char alphanum[] ="0123456789""ABCDEFGHIJKLMNOPQRSTUVWXYZ""abcdefghijklmnopqrstuvwxyz";
int size = sizeof(alphanum) - 1;
int main()
{
    int length = 16;
    srand(time(0));
    for (int i = 0; i < length; i++)
    {
        cout << alphanum[rand() % ::size];
    }
    return 0;
}

23. By Alok Sinha

Made by Alok Sinha. Enter password length for a random password that contains capital and small alphabets with numbers and symbols. ( Source )


#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() 
{
srand(time(0));
string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789" "@&$?#%!~";
int x,n,cha;
cha= chars.length();
cin >>n;
cout << "Your Password is : ";
while(x < n){
    cout << chars[rand() % cha];
    x++;
}
    return 0;
}

24. By Diogo Pinto

Basic C++ Password Generator by Diogo Pinto. You can generate a random password between 1 – 32 in length. ( Source )

//created by Diogo Pinto.

#include <cstdlib>
#include <iostream>
#include <ctime>

using namespace std;
int main() {
int b;
cin>>b;

char a[]= {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1','2', '3','4','5','6','7','8','9','@','#','$','&'};

if(b>=8 && b<=32){

std::srand(std::time(nullptr));
    int random_variable = std::rand();
 
    for (int n=0; n != b; ++n) {
        int x = 41;
        while(x > 40) 
            x = 1 + std::rand()/((RAND_MAX + 1u)/40);  
        
        std::cout << a[x] << ' ';
    }

}
   else{ 
   cout<<"the length should be between 8 and 32!!";
}
    return 0;
}

25. By Daljeet Singh

Made by Daljeet Singh. Enter password length between 1 – 999 to generate a random password. ( Source )

     //😍😎enter length of passwordπŸ˜‚πŸ˜™ 
#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int main ()

{

static const char arr[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789" "*&^/ $#@!_" ;

int stringLenth  =sizeof(arr) - 1,length ;

    srand(time(0));
    
    cout <<"your password length-> ";
    
    cin>>length;
    
    if (length<1 || length>999)
    {
        cout <<"value between 1-999 and no  alphabets allowed"<<endl<<"\nPassword should be long and strong..Nice Try Though ";
        
    }
    
    else
    
    {
    
    cout <<length<<endl;
    
    for (int x = 0; x < length; x++)
    
        {
    
    cout<<arr [rand () %stringLenth];
    
        }
        
    cout <<"\nKeep it safe..";//πŸ˜†
    
    }
   return 0;
}

26. By Elfox

Made by Elfox. Enter password length for a randomly generated password that contains numbers, symbols and alphabets. ( Source )

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

const std::string GEN_SYM = "0123456789"                 
                            "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 
                            "abcdefghijklmnopqrstuvwxyz"
                            "[email protected]#$%^&*";

int main() {
    int pass_length;
    std::cin >> pass_length; // 1
    if (pass_length<=0) {
        std::cerr << "Error: password lenght is equal or less 0";
        return 1;
    }
    srand(time(0));
    std::string password;
    for (int i = 0; i<pass_length; i++) {
        int id_gen_sym = rand()%GEN_SYM.size();
        password += GEN_SYM[id_gen_sym];
    }
    std::cout << "Password: " << password;
}

27. By Levishcheko Dmitry Anatolievich

Made by Levishcheko Dmitry Anatolievich. ( Source )

#include <iostream>
#include <ctime>
#include <random>

int main(void)
{
    char buffer[] = "zxcvbnm,./<asdfghjkl;'\\qwertyuiop[]1234567890-=ZXCVBNMASDFGHJKLQWERTYUIOP<>[email protected]#$%^&*()_+";
    unsigned int bufSize = sizeof(buffer) - 1;
    unsigned int n = 0;

    std::cout << "Password generator!\n";
    std::cout << "Enter the number of characters\n";
    std::cout << "> ";
    std::cin >> n;
    std::srand(std::time(0));

    while(n--)
    {
        std::cout << buffer[(std::rand()%bufSize)];
    }
    std::cout << "\n";

    return 0;
}

28. By Kawaii

C++ Password Generator by Kawaii. ( Source )

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
int main() {
	char c[] = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!\"#$%&/()=-_";
	int size = sizeof(c) - 1;
	srand(time(0));
	int length;
	cout << "How many characters do you want your password?" << endl;
	cin >> length;
	int x;
	string password;
	for (x = 0; x < length; x++) {
		password += c[rand() % size];
	}
	cout << "Your password is: " << password << endl;
	return 0;
}

29. By Bodan Talev

Made by Bodan Talev. Enter the password length between 8 – 32 to generate a random password. ( Source )


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <ctime>

using namespace std;

int main() {
    string password[]= {
      "A","B","C","D","E","F","G","H","I","J",
      "K","L","M","N","O","P","Q","R","S","T",
      "U","V","W","X","Y","Z","a","b","c","d",
      "e","f","g","h","i","j","k","l","m","n",
      "o","p","q","r","s","t","u","v","w","x",
      "y","z","0","1","2","3","4","5","6","7",
      "8","9","@","&","#","$","_",".","-","!"
    };
    
    int i,n;
    cin>>n;
    if(n<8 || n>32) {
        cout<<"The number shouldn't be smaller than 8 or bigger than 32.\nTry again...";
        return 0;
    }
    else {
        cout<<"Your password is:\n";
        srand(time(NULL));
        
        for(i=1;i<=n;i++)
            cout<<password[rand()%70];
    }
    return 0;
}

30. By Prabhakar Dev

Made by Prabhakar Dev. The source code generates a random 8 digit password. ( Source )

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main () {
srand(time(0));
    for (int x = 1; x <= 1; x++) {
    string al[62] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", };
        cout << al[rand()%62]+al[rand()%62]+al[rand()%62]+al[rand()%62]+al[rand()%62]+al[rand()%62]+al[rand()%62]+al[rand()%62] << endl;
    }
}

31. By Nick

Made by Nick. This generator has 14 options to choose from for generating your password, you have different options like ‘only lowercase letters, numbers and other characters, only letters and numbers’ etc. Choose the option you want to use and enter the password length with space between in the same line. ( Source )

//HOW TO USE input two numbers the first number tells the program which characters to use (number between 0 and 14) the second number is the password length
//like if you enjoyed ^^
//report any bugs pls :P

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;

int main() {
    string i;
    int o, p;
    string pass = "abcdefghijklmnopqrstuvwxyz";//26
    string pass2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";//26
    string pass3 = "0123456789";//10
    string pass4 = "@:;_-#()/+.,?!'\"=\\%*[]{}<>$^";//30
    cin >> p;
    if (p < 0 || p > 14) {
        cout << "first number: you should choose a number between 0 and 14 default 0\n";
    }
    if (p == 0) {
        i = pass + pass2 + pass3 + pass4;
        cout << "all characters (0)\n";
        o = 92;
    }
    if (p == 1) {
        i = pass + pass2 + pass3;
        cout << "only letters and numbers (1)\n";
        o = 62;
    }
    if (p == 2) {
        i = pass + pass2 + pass4;
        cout << "only letters and other characters (2)\n";
        o = 82;
    }
    if (p == 3) {
        i = pass + pass3 + pass4;
        cout << "only lowercase letters, numbers and other characters (3)\n";
        o = 66;
    }
    if (p == 4) {
        i = pass2 + pass3 + pass4;
        cout << "only uppercase letters, numbers and other characters (4)\n";
        o = 66;
    }
    if (p == 5) {
        i = pass + pass2;
        cout << "only letters (5)\n";
        o = 52;
    }
    if (p == 6) {
        i = pass + pass3;
        cout << "only lowercase letters and numbers (6)\n";
        o = 36;
    }
    if (p == 7) {
        i = pass + pass4;
        cout << "only lowercase letters and other characters (7)\n";
        o = 56;
    }
    if (p == 8) {
        i = pass2 + pass3;
        cout << "only uppercase letters and numbers (8)\n";
        o = 36;
    }
    if (p == 9) {
        i = pass2 + pass4;
        cout << "only numbers and othet characters (9)\n";
        o = 56;
    }
    if (p == 10) {
        i = pass3 + pass4;
        cout << "only numbers and other characters (10)\n";
        o = 40;
    }
    if (p == 11) {
        i = pass;
        cout << "only lowercase letters (11)\n";
        o = 26;
    }
    if (p == 12) {
        i = pass2;
        cout << "only uppercase letters (12)\n";
        o = 26;
    }
    if (p == 13) {
        i = pass3;
        cout << "only numbers (13)\n";
        o = 10;
    }
    if (p == 14) {
        i = pass4;
        cout << "only other characters (14)\n";
        o = 30;
    }
    pass += pass2 + pass3 + pass4;
    int length;
    srand(time(0));
    cin >> length;
    int random; //92 characters
    cout << "Your password with " << length << " characters:\n";
    for (length; length > 0; length--) {
        random = rand() % o;
        cout << i[random];
    }
    return 0;
}

32. By Terminator

Made by Terminator. Enter password length between 8 – 32 for a random password. ( Source )

#include <iostream>
#include <cstdlib>
#include <ctime>
#define i int
#define notmain int main()
#define print(a) cout<<a;
#define input(a) cin>>a;

using namespace std;
/*
if entered length<8,length=8;
if entered length>32,length=32;
if entered length=string or char, length=8;
*/

 notmain {
    try{
    i length;
    wchar_t b;
    input(length)
        if(length<8){
       length=8;
    }
        if(length>32){
      length =32;
    }
      b=255;
  print("Password length:")
  print(length)
  print(endl)
  print("==================")
  print(endl)
  print("Password:")

 srand(time(0));
      for(i l=0;l<length;l++){
      char d=rand()%b;
   while(d<40){
       d=(rand()%b);
   };
   while(d>=256){
         d=(rand()%b);
   };
        wcout <<d;
  };
  }
catch(...){
print(">\n>>>>\nERROR\n>>>>>\n");
  }
 return 0;
}

33. By Mohd Maaz Azhar

Simple Password Generator by Mohd Maaz Azhar. There is no limit to password length. ( Source )


#include <iostream>
using namespace std;
int main() {
int n;
cout<<"Enter the number of letters in password ";
cin>>n;
string str="";
srand(time(NULL));
for(int i=0;i<n;i++)
{
int r=rand()%4;
    if(r==0)
    {
        int rd=rand()%26;
        char c=65+rd;    
        str+=c;
    }
    else if(r==1)
    {
        int rd=rand()%26;
        char c=97+rd;
        str+=c;
    }
    else if(r==2)
    {
        int rd=rand()%10;
        char c=48+rd;
        str+=c;
    }
    else if(r==3)
    {
        int rd=rand()%4;
        char c=35+rd;
        str+=c;
    }
}
cout<<"\nGenerated password :- "<<str;
    return 0;
}

34. By Coder

Made by Coder. Enter password length for a random password, there is no password length limit. ( Source )

// Created by Coder        
#include<iostream> 
#include<string> 
#include<cstdlib> 
#include<ctime> 
using namespace std; 
static const char alphanum[]="0123456789" "[email protected]#$%^&*" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"; 
int stringLength=sizeof(alphanum)-1; 
char genRandom()
{ 
 return alphanum[rand()%stringLength]; 
} 
 int main() 
 { 
  int n;
  srand(time(0));
  cout<<"Enter the length of the password required:";
  cin>>n;
  cout<<n<<endl;
  cout<<"Your Password is:";
  for(int z=0; z < n; z++) 
  { 
    cout<<genRandom(); 
  } 
   return 0; 
}

35. By mikinol_play

Made by mikinol_play. Generates a random password that is 32 digits in length. ( Source )

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main() {
srand(time(0));
char g[]=
"1234567890"
"qwertyuiopasdfghjklzxcvbnm"
"QWERTYUIOPASDFGHJKLZXCVBNM"
"%^~|[]<>{}@#&*-+=()_/|";
unsigned short int size = sizeof(g)-1;
//legith password
unsigned short int legith=35;//<<legith
//legith password
    while(legith!=0){
        cout<<g[rand()%size];
        legith--;
    }
}

36. By Piyush Yadav

A simple program by Piyush Yadav to generate a password. Enter password length to get a random password. ( Source )


// By- Piyush yadav.
// Thanks to alex (creator of learncpp.com) and nascardriver (forum helper). For teaching me cpp.

#include <iostream>
#include <ctime>
using std::cin;
using std::cout;
using std::endl;
using std::string;

// Creating a custom Random number generator Function using system's Time.

int genRandom(int len)
{
	// our initial starting seed is current time.
	static unsigned int seed = static_cast<unsigned int>(std::time(nullptr));
	// Take the current seed and generate a new value from it the magic is due to overflow.
	seed = 8253729 * seed + 2396403;

	// Take the seed and return a value between 0 and length of the password.
	return seed % len;
}

//Function to generate the password.

string genPassword(int len)
{
	string passList{"[email protected]#$%^&*?_:"};
	string password;
	for(int a{0};a<len;a++){
		password+=passList[genRandom(74)];
	}
	return password;
}

//Function to display the generated password with decoration.

void screen(string pass,int len)
{
	cout<<endl<<endl;
	for(int a{0};a<=len+20;a++){
		cout<<"*";
	}
	cout<<endl<<endl;
	cout<<"Password Length :"<<len<<endl;
	cout <<"Generated Password :"<< pass<<endl<<endl;
	for(int a{0};a<=len+20;a++){
		cout<<"*";
	}
}

//Most respected function.

int main()
{
	unsigned int length{0};
	while (true)
	{
		cout << "Enter the length of password :";
		cin >> length;
		if (cin.fail())
		{
			cin.clear();
			cin.ignore(32767, '\n');
			std::cout << "Invalid Input" << endl;
		}
		else if (length > 32)
		{
			cout << "Password length overflow" << endl;
		}
		else
		{
			break;
		}
	}
	screen(genPassword(length),length);
	return 0;
}

37. By Marko Radusinović

C++ Password generator by Marko RadusinoviΔ‡. Enter password length for random password. The limit for password length is between 8 – 32. ( Source )

/*
Given the password length as input, create a program that will generate a random password by using a set of characters. The length must be between 8 and 32 characters.

Examples:
Input: 8
Output: aR67+oP_

Input: 12
Output: kS5h7a*[email protected]
*/
#include <iostream>
#include <ctime>
#include <vector>
#include <string>

int main()
{
    int n;
    std::cin >> n;
    if (n < 8 || n > 32)
    {
        std::cout << "The length of your password must be between 8 and 32." << std::endl;
        return 0;
    }
    std::vector<char> vec;
    srand(time(NULL));
    for (int i = 0; i < n; ++i)
        vec.push_back((char)(33 + rand() % 93));
    std::string pass(vec.begin(), vec.end());
    std::cout << "Generated password is: ";
    std::cout << pass;
}

38. By Akshat2001

Made by Akshat2001. ( Source )

password generator
how mAny digits you want in password 10
here is your 10 digit password>948593605
#include <iostream>
#include<ctime>
#include<cstdlib>
using namespace std;

int main() { 
int n,res; 
srand(time(0));
 cout<<"password generator"<<endl;
cout<<"how mAny digits you want in password";
cin>>n;
for(int i=0;i<=n;++i)
res=(n+1)+rand();
cout<<"\n here is your "<<n<<" digit password>"<<res<<endl;
    return 0;
}
/* note done the password and try that on 
 program */

39. By Abdurrahman Yabani

Made by Abdurrahman Yabani. ( Source )

how many characters do u like ur password to be?
NOTE: enter between 8 and 32
20
your new password is:
>slEt9uE[-:Jcd\.^1T8
#include <iostream>
#include <cstring>
#include <ctime>
#include <cstdlib>
using namespace std;

int main() {
// 33-90 is the ASCII character
srand(time(0));
cout<<"how many characters do u like ur password to be?"<<endl;
cout<<"NOTE: enter between 8 and 32"<<endl;
int num;
esc:
cin>>num;
if (num>=8 && num<=32){}
else{
    cout<<"please enter between 8 and 32!!!"<<endl;
goto esc;
}
for(int y=0;y<num;y++){
	int ascii=33+(rand()%90);
	if (y==0){
	
		cout<<"your new password is:"<<endl;
		cout<<char(ascii);
	}
   
	  else{
		  cout<<char(ascii);
	  }
   
	
}
cout<<endl<<endl<<endl;
cout<<"thank you for using my program and dont forget to upvote thank you"<<endl;


	return 0;
}

40. By Ivan Zabara

Made by Ivan Zabara. A Simple C++ pass generator. ( Source )

Input: 10
Output: hh!>kO{&JA>
#include <iostream>
#include <ctime>
using namespace std;

bool checkAndShow(int len);
void showOutput(char *password, int len);
char* generatePassword(int len);

int main()
{
    srand(time(NULL));
    int len = 0;
    cin >> len;

    if (!checkAndShow(len))
        return 0;

    showOutput(generatePassword(len), len);

    return 0;
}

bool checkAndShow(int len)
{
    if (len < 8 || len > 32)
    {
        cout << "\nThe length must be ";
        cout << "between 8 and 32." << endl;
        return false;
    }
    else
    {
        cout << "\nInput: " << len << endl;
        return true;
    }
}

char* generatePassword(int len)
{
    char* password = new char[len];

    for (int i = 0; i <= len; i++)
        password[i] = char((33 + rand() % (126 - 33))); //ASCII 33 = '!', 126 = '~'
    return password;
}

void showOutput(char *password, int len)
{
    cout <<"Output: ";
    for (int i = 0; i <= len; i++)
        cout << password[i];
    cout << endl;
    
    delete password;
}


41. By Paul Bradley

Made by Paul Bradley. ( Source )

Input: 
Your password is: *[email protected]]{aB|
#include <iostream>
#include <vector>
#include <ctime>

using namespace std;

bool isspecial(int);

int main() {

	int length;
	srand(time(0));
	int currentRandom;
	char newChar;
	bool hasUpper = false;
	bool hasLower = false;
	bool hasNum = false;
	bool hasSpecial = false;
	bool goodPasswd = false;

	cout << "Input: "; 
	cin >> length;
	cout << endl;
	
	//check for valid length
	if (length < 8 || length > 32) {
		cout << "Length must be between 8 and 32 characters";
	return -1;
	}
	
	//create string for the password;
	vector <string> password(length);
	
	//main loop which repeats until we have a good password
	while(goodPasswd == false) {
		for (int i = 0; i < length; i++) {
			//generate a random number between 33 and 126
			currentRandom = static_cast<double>(rand()) / RAND_MAX * 93 + 33;
			//translate number into ASCII character
			newChar = static_cast<char>(currentRandom);
			
			//check to see what type the new charactor is
			if (isupper(newChar))
				hasUpper = true;
			if (islower(newChar))
				hasLower = true;
			if (isdigit(newChar))
				hasNum = true;
			if (isspecial(currentRandom))
				hasSpecial = true;
			
			//add the new character to the password string;
			password[i] = newChar;
			}
			
			//new password is now built. see if it has all the components
			if (hasUpper == true && hasLower == true && hasNum == true && hasSpecial == true)
				goodPasswd = true;
			else {
				//password is missing something so reset everything and generate a new one 
				hasUpper = false;
				hasLower = false;
				hasNum = false;
				hasSpecial = false;
			}
	}
	cout << "Your password is: ";
	for(int i = 0; i < length; i++) 
		cout << password[i];
	
	return 0;
}

bool isspecial(int checkthis) {
	if (checkthis < 48)
		return true;
	else
		return false;
}

42. By SEYED SEPANTA HOSSEINIPOUYA

Made by SEYED SEPANTA HOSSEINIPOUYA. ( Source )

how many chars you want to have in your password
8
your password is: ,jgY]@l{
#include <iostream>
#include <ctime>
using namespace std;

int main(){
    int a;
    cout<<"how many chars you want to have in your password\n";
    cin >> a;
    char* NEW=new char[a];
    string main={"1234567890-=`[email protected]#$%^&*()_+qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:ZXCVBNM<>?"};
    srand(time(0));
    int i;
    for(i=0;i<a;i++){
        NEW[i]=main[rand() % 92];
    }
    cout <<"your password is: ";
    cout << NEW  << endl;
}