Zadanie:
Generator losowych znaków z tablicy ASCII tworząc hasło o długości od 12 do 26 znaków.
Rozwiązanie:
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <string>
using namespace std;
int main()
{
srand(time(NULL));
int length_password = rand()%15+12;
cout << length_password << endl;
string password = "";
for (int i=0; i<length_password; i++)
{
password = password + char(rand()%94+33);
}
cout << password << endl;
return 0;
}