CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Generate a string of N characters,
including uppercase letters, lowercase letters and numbers
*/
#include<ctime>
#include<cstdlib>
#include<iostream>
using namespace std ;
int main ( ) {
srand (time(NULL)) ;
int alea=0 , N ;
string caract [] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","U","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","Q","L","M","N","O"
,"P","Q","R","S","T","U","V","W","X","Y","Z" } ;
cout << " write your N characteres : " ; cin >> N ;
alea = rand()%( 52-1 +1 ) +1 ;
for ( int i=0 ; i<=N-1 ; i++ )
cout << caract[alea] ;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run