-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomPwd.c
More file actions
60 lines (51 loc) · 1023 Bytes
/
RandomPwd.c
File metadata and controls
60 lines (51 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
char tab[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char tab2[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char tab3[11] = {'0','1','2','3','4','5','6','7','8','9'};
int a = 0;
int j = 0;
printf("Generateur de Mot de Passe Aléatoire :\n");
printf("Nombre de caracère ? :\n");
printf("\n");
printf("6 ?\n");
printf("8 ?\n");
printf("10 ?\n");
printf("12 ?\n");
printf("14 ?\n");
printf("16 ?\n");
scanf("%d", &a);
char tab4[a];
int z = 0;
srand(time(0));
while (z<a)
{
j = 0;
j=rand()%3+1;
if( j == 1)
{
tab4[z] = tab[rand()%26+0];
z++;
}
else if( j == 2)
{
tab4[z] = tab2[rand()%26+0];
z++;
}
else if( j == 3)
{
tab4[z] = tab3[rand()%11+0];
z++;
}
}
int t = 0;
for( t = 0; t<a; t++)
{
printf("%c",tab4[t]);
}
printf("\n");
return 0;
}