You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
690 B

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
int run_passwortGenerator(){
printf("\nPasswort Generator\n\n");
char zeichen[] = "abcdefghijklmnopqrstuvwxyz0123456789!%&/()=?*#";
while(1){
int eing = 0;
printf("Tippen Sie die gewuenschte Passwortlaenge ein, um ein neues zu generieren\noder '0' um das Programm zu beenden: ");
scanf("%d", &eing);
int tmp = 0;
int GroSSklein = 0;
if(eing == 0){return 0;}
printf("\nIhr Passwort: ");
srand(time(0));
for(int i = 0; i < eing; i++)
{
tmp = rand()%46;
GroSSklein = rand()%2;
printf("%c", (tmp<26?(GroSSklein==0?toupper(zeichen[tmp]):zeichen[tmp]):zeichen[tmp]));
}
printf("\n");}
return 0;
}