Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. int pw(void){
  2. int i, n_passwords;
  3. int j = 1, k;
  4. char c;
  5. printf("Indique o número de passwords que deseja : ");
  6. scanf("%d", &n_passwords);
  7. char pass[n_passwords][14];
  8.  
  9. srand(time(NULL));
  10. while (j <= n_passwords){
  11. k = 0;
  12. for (i = 0; i < 3; ++i){
  13. c = 'a' + rand() % ('z' - 'a' + 1);
  14. printf("%c", c);
  15. pass[j-1][k++] = c;
  16. }
  17. for (i = 0; i < 3; ++i){
  18. c = 'A' + rand() % ('Z' - 'A' + 1);
  19. printf("%c", c);
  20. pass[j-1][k++] = c;
  21. }
  22. for (i = 0; i < 3; ++i){
  23. c = '1' + rand() % ('1' - '9' + 1);
  24. printf("%c", c);
  25. pass[j-1][k++] = c;
  26. }
  27. for (i = 0; i < 4; ++i){
  28. c = '!' + rand() % ('!' - '/' + 1);
  29. printf("%c", c);
  30. pass[j-1][k++] = c;
  31. }
  32. j++;
  33. printf("\n\n");
  34. }
  35. system("pause");
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement