Advertisement
STANAANDREY

key_gen

May 9th, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <time.h>
  4. #include <cstdlib>
  5. #include <string>
  6. #include <fstream>
  7. #define len1 5
  8. #define ull unsigned long long
  9. #define ush unsigned short
  10. #define ulg unsigned long
  11. using namespace std;
  12. ofstream fout("text.txt");
  13.  
  14. int main()
  15. {
  16.     ull x;
  17. cout<<"nr coduri:";cin>>x;
  18. srand(time(NULL));
  19. vector <char> alfa;
  20. for (char let='A';let<='Z';let++)
  21. alfa.push_back(let);
  22. for (char nr='0';nr<='9';nr++)
  23. alfa.push_back(nr);
  24. for (ulg c=0;c<x;c++)
  25. {
  26.    for (ush i=0;i<len1;i++) {
  27.     for (ush j=0;j<len1;j++)
  28.    fout<<alfa.at(rand()%(alfa.size()));
  29.    if (i!=4)
  30.    fout<<'-';
  31.    }
  32.    fout<<endl;
  33. }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement