From 3ac61e2e56ceb779b6f7ec4ed93039739c2ed205 Mon Sep 17 00:00:00 2001 From: Kevin Ludwig Date: Thu, 8 Feb 2024 18:56:26 +0100 Subject: [PATCH] Passwortgenerator buchstaben + zahlen --- src/passwortgenerator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/passwortgenerator.c b/src/passwortgenerator.c index fe3f685..60d7d5e 100644 --- a/src/passwortgenerator.c +++ b/src/passwortgenerator.c @@ -5,16 +5,16 @@ int run_passwortGenerator(){ printf("\nPasswort Generator\n\n"); - char zeichen[] = "abcdefghijklmnopqrstuvwxyz"; + char zeichen[] = "abcdefghijklmnopqrstuvwxyz0123456789"; int tmp = 0; int GroSSklein = 0; printf("\nIhr Passwort: "); srand(time(0)); for(int i = 0; i < 10; i++) { - tmp = rand()%26; + tmp = rand()%36; GroSSklein = rand()%2; - printf("%c", (GroSSklein==0?toupper(zeichen[tmp]):zeichen[tmp])); + printf("%c", (tmp<26?(GroSSklein==0?toupper(zeichen[tmp]):zeichen[tmp]):zeichen[tmp])); } printf("\n"); return 0;