#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
int num;
int i=1;
srand(time(NULL));
char char_arr[64]={"zAyBxCwDvEuF***HrIqKpLoMnNmOlPkQjRiShTgUfVeWdXcYbZa1928374560!-"};
while (i==1){
cout << "How many characters? ";
cin >> num;
cout << "\nRandom password: ";
for (int i=0; i<num; i++)
cout << char_arr[rand() % 63];
cout << "\n\n";
cout << "Again? (0 to quit)";
cin >> i;
cout << "\n\n";
}
return 0;
}

#include <iostream>
#include <string>
#include <cstdlib>
#include <time.h>
using namespace std;
int generate(int len);
void main(void)
{
int exit;
int length;
while(true){
cout << "How many chars?\n";
cin >> length;
generate(length);
cout<<"\n\nExit?\n1=yes\n2=no\n";
cin>>exit;
cout<<"\b";
if (exit==1){
break;
}
}
}
int generate(int len){
string poss="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int rand_num;
srand(time(NULL));
string pass;
for (int x=1;x<=len;x++){
rand_num=rand() % 62;
pass+=poss.at(rand_num);
}
cout<<"password: "<<pass<<endl;
return 0;
}


. I guess this is just a snippet but otherwise you should write the pass to a file, hard to copy the pass from the console

