Browse Source

Passwortgenerator klein und grossbuchstaben

remotes/origin/tictactoedev
Kevin Ludwig 11 months ago
parent
commit
b5c96080a3
  1. 7
      src/passwortgenerator.c

7
src/passwortgenerator.c

@ -1,17 +1,20 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <ctype.h>
int run_passwortGenerator(){ int run_passwortGenerator(){
printf("\nPasswort Generator\n\n"); printf("\nPasswort Generator\n\n");
char zeichen[] = "abcdefghijklmnopqrstuvwxyz"; char zeichen[] = "abcdefghijklmnopqrstuvwxyz";
int tmp = 0; int tmp = 0;
int GroSSklein = 0;
printf("\nIhr Passwort: "); printf("\nIhr Passwort: ");
srand(time(0)); srand(time(0));
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++)
{ {
tmp = rand() % 26;
printf("%c", zeichen[tmp]);
tmp = rand()%26;
GroSSklein = rand()%2;
printf("%c", (GroSSklein==0?toupper(zeichen[tmp]):zeichen[tmp]));
} }
printf("\n"); printf("\n");
return 0; return 0;

Loading…
Cancel
Save