main.cpp 626 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # include <iostream>
  2. # include <ctime>
  3. # include <cstdlib>
  4. # include <string>
  5. # define MAJ_JUMP int('A') - int('a')
  6. // Génère un nom de minion aléatoirement.
  7. using namespace std ;
  8. string create( int mini = 2, int maxi = 6 )
  9. {
  10. string rep("");
  11. string voy("aeiouy");
  12. string cons("bcdfghjklmnpqrstvwxy");
  13. int n( rand() % (maxi - mini) + mini );
  14. int k;
  15. for ( int i(0); i < n; i ++ )
  16. {
  17. k = rand() % cons.size();
  18. rep += cons[k];
  19. k = rand() % voy.size();
  20. rep += voy[k];
  21. }
  22. rep[0] = char( int(rep[0]) + MAJ_JUMP );
  23. return rep;
  24. }
  25. int main()
  26. {
  27. srand( time(0) );
  28. cout << create() << endl ;
  29. return 0;
  30. }