Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "sprawdzacz.h"
- #include <time.h>
- #include <cstdlib>
- #include <conio.h>
- using namespace std;
- string generujhaslo(int dl)
- {
- string haslo = "";
- int znak;
- for (int i = 0; i < dl; i++)
- {
- znak = (rand()%93) + 32;
- if (znak == 32)
- {
- i--;
- continue;
- }
- haslo = (char)znak + haslo;
- }
- return haslo;
- }
- int main()
- {
- sprawdzacz sp;
- char ile[] = "10000000000";
- int ile_cal;
- srand(time(NULL));
- cout << " GENERATOR LOSOWYCH HASEL" << endl << endl << endl;
- cout << "Z ilu znakow ma skladac sie haslo?" << endl;
- cout << "Ile: ";
- cin >> ile;
- if (sp.tylko_cyfry(ile) == false)
- {
- ile_cal = atoi(ile);
- cout << endl << endl;
- cout << "Haslo: ";
- cout << generujhaslo(ile_cal);
- }
- else
- {
- cout << "Bledna ilosc znakow!";
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment