#include <iostream> #include <ctime> #include <string> using namespace std; int main() { srand(time(0)); cout << "Hello World!\n"; string data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmopqrstuvwxyz" "1234567890" "@#',.$&^-_+={}[}()*?!%\/<>"; string pass; for (int i = 0; i <= 8; i++) { pass = pass + data[rand() % 105]; } cout << "Your random password is " << pass << endl; }
data
0
104
88
% 88
% 105
'n'
length()
pass += data[ rand() % data.length() ];
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)