Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- #include <conio.h> //_getch();
- #include <Windows.h>
- #include <ctime> //time_t, struct tm, localtime_s, strftime
- using namespace std;
- char* tag(){
- //char *random1 = new char[];
- //random1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- // size_t size1 = (sizeof random1 / sizeof random1[0]);
- //char *random2 = new char[];
- //random2 = "0123456789";
- // size_t size2 = (sizeof random2 / sizeof random2[0]);
- char random1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- char random2[] = "0123456789";
- size_t size1 = (sizeof random1 / sizeof random1[0]-1);
- size_t size2 = (sizeof random2 / sizeof random2[0]-1);
- int r1 = 0;
- int r2 = 0;
- char ra1[5] = "";
- char ra2[4] = "";
- char s[9] = "";
- for(int i = 0; i<4; ++i){
- r1 = rand() % size1;
- ra1[i] = random1[r1];
- }
- for (int i = 0; i < 4; ++i){
- r2 = rand() % size2;
- ra2[i] = random2[r2];
- }
- sprintf_s(s,"%c%c%c%c-%c%c%c",ra1[0],ra1[1],ra1[2],ra1[3],ra2[0],ra2[1],ra2[2]);
- cout << s << endl;
- _getch();
- //delete [] random1;
- //delete [] random2;
- return s;
- }
- const time_t ctt = time(0);
- int main(){
- cout << tag();
- _getch();
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement