[cpp]
/*
Passwort Generator by Becks
=============================
Credits:
– Krusty
Greetings:
– Dr.Sp!c
– Krusty
– Acsii
Visit:
Youtube.com/becksscene
*/
#include <iostream>
#include <time.h>
#include <stdlib.h>                 // für srand
#include <string.h>                 // für strlen
#include <stdio.h>
#include <windows.h>            //für Clipboard
using namespace std;
int GetRandomNumber(int min, int max)
{
	return min + (rand()%(max – min));
}
char * GeneratePw(int len)
{
	char pwd[] = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890!§$%&/()=?"; //Zeichen aus denen das PW besteht
	char *password = new char[len];
srand(time(NULL));
for(int i=0; i<len; i++)
	{
		password[i] = pwd[GetRandomNumber(0,strlen(pwd))];              //strlen(pwd) ließt die charliste
	}
	password[len] = ‚\0‘;                                       //string ende hört mit ‚\0‘ auf
	return password;
}
//=========================Begin-Clipboard-Function==========================
BOOL SetClipboardText(char text[])
{
    if
    (OpenClipboard(NULL) == FALSE){
    return FALSE;
}
    if
    (EmptyClipboard() == FALSE){
    return FALSE;
}
    HGLOBAL hGlob = GlobalAlloc(GMEM_FIXED, strlen(text) + 1);
    if
    (hGlob != NULL)
{
    strcpy((char*)hGlob, text );
                    //printf(": %s",hGlob);
    if
    (SetClipboardData( CF_TEXT, hGlob )== FALSE)
{
    return FALSE;
}
}
else
{
return FALSE;
}
return CloseClipboard();
}
//============================END-Clipboard-Function============================
 int main()
 {
    cout << "Password Generator by Becks" << endl;
    cout << "===========================" << endl;
    cout << endl;
    cout << "With help from my friend Krusty <3" <<endl;
    cout << endl;
    cout << "Text will be copied to your clipboard!" <<endl;
    cout << endl;
    cout << endl;
    cout << "Choose your password length: ";
    int len1;
    cin >> len1;
//char *n = GeneratePw(len1);
//SetClipboardText(n);
    char eingabe = 0;
    do
{
    char *n = GeneratePw(len1);
    cout << (n) << endl;
    eingabe = 0;
    if
        (SetClipboardText(n) == FALSE)
{
cout <<"Unable to put text in clipboard\n"<<endl;
}
cout << endl;
cout << "Another password (Y)es\n" << endl;
cin >> eingabe;
}
while(eingabe == ‚Y‘);
	system("Pause");
	return 0;
}
[/cpp]
                                                                    