- Get link
- X
- Other Apps
#include <stdio.h>
#include <stdlib.h>
int main() {
srand((unsigned int) time(NULL));
int arrLen;
printf("Enter the length of your password you want: ");
scanf("%d", & arrLen);
printf("\nYour password is: ");
int pass[arrLen], index = 0, isSame = 1, len = arrLen;
while (len) {
int random = rand() % 127;
if (random < 33) {
continue;
}
for (int i = 0; i < index; i++) {
if (pass[i] == random) {
isSame = 0;
break;
} else {
isSame = 1;
}
}
if (isSame) {
pass[index] = random;
index++;
len--;
printf("%c", random);
}
}
return 0;
}
// 33-126
#include <stdlib.h>
int main() {
srand((unsigned int) time(NULL));
int arrLen;
printf("Enter the length of your password you want: ");
scanf("%d", & arrLen);
printf("\nYour password is: ");
int pass[arrLen], index = 0, isSame = 1, len = arrLen;
while (len) {
int random = rand() % 127;
if (random < 33) {
continue;
}
for (int i = 0; i < index; i++) {
if (pass[i] == random) {
isSame = 0;
break;
} else {
isSame = 1;
}
}
if (isSame) {
pass[index] = random;
index++;
len--;
printf("%c", random);
}
}
return 0;
}
// 33-126
- Get link
- X
- Other Apps
Comments
Post a Comment