12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- # include <iostream>
- # include <ctime>
- # include <cstdlib>
- # include <string>
- # define MAJ_JUMP int('A') - int('a')
- // Génère un nom de minion aléatoirement.
- using namespace std ;
- string create( int mini = 2, int maxi = 6 )
- {
- string rep("");
- string voy("aeiouy");
- string cons("bcdfghjklmnpqrstvwxy");
- int n( rand() % (maxi - mini) + mini );
- int k;
- for ( int i(0); i < n; i ++ )
- {
- k = rand() % cons.size();
- rep += cons[k];
- k = rand() % voy.size();
- rep += voy[k];
- }
- rep[0] = char( int(rep[0]) + MAJ_JUMP );
- return rep;
- }
- int main()
- {
- srand( time(0) );
- cout << create() << endl ;
- return 0;
- }
|