-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRPG Naive.cpp
More file actions
47 lines (46 loc) · 1.16 KB
/
RPG Naive.cpp
File metadata and controls
47 lines (46 loc) · 1.16 KB
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
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int i = 0;
int n = 0;
int randomizer = 0;
srand((time(NULL)));
char numbers [] = "1234567890";
char letter [] = "abcdefghijklmnoqprstuvwyzx";
char letterr [] = "ABCDEFGHIJKLMNOQPRSTUYWVZX";
char symbols [] = "!@#$%^&*(){}[]:<>?,./";
printf("\nHow long password:");
scanf("%d", &n);
char password[n];
randomizer = rand() % 4;
for (i=0;i<n;i++)
{
if(randomizer == 1)
{
password[i] = numbers[rand() % 10];
randomizer = rand() % 4;
printf("%c", password[i]);
}
else if (randomizer == 2)
{
password[i] = symbols[rand() % 26];
randomizer = rand() % 4;
printf("%c", password[i]);
}
else if (randomizer == 3)
{
password[i] = letterr[rand() % 26];
randomizer = rand() % 4;
printf("%c", password[i]);
}
else
{
password[i] = letter[rand() % 21];
randomizer = rand() % 4;
printf("%c", password[i]);
}
}
return main();
}