-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.c
66 lines (58 loc) · 1.5 KB
/
hello.c
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
61
62
63
64
65
66
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char matrix[20][10];
char *password[] = {"?", "{", "}", ".", ",", "Onur", "Anil", "Alperen"};
int isfinish = 1;
int a;
int prevrnd;
for(int i = 0; i < 20; i++)
{
printf("%d ", i + 1);
for(int j = 0; j < 10;)
{
int rndn1 = rand() % 8;
if (isfinish == 0)
{
for(; a < strlen(password[prevrnd]); a++)
{
printf("%s", password[prevrnd][a]);
j++;
}
isfinish = 1;
password[prevrnd] = "";
continue;
}
if(strlen(password[rndn1]) > 10 - j)
{
int z = 0;
for(; z < 10 - j; z++)
{
printf("%s", password[rndn1][z]);
}
j += 10 - j;
isfinish = 0;
a = z + 1;
prevrnd = rndn1;
}
else if (password[rndn1] == "")
{
printf("%s", password[rand() % 5]);
j++;
}
else
{
printf("%s", password[rndn1]);
j += strlen(password[rndn1]);
if(strlen(password[rndn1]) > 1)
{
password[rndn1] = "";
}
}
}
printf("\n");
}
return 0;
}