main.cpp 784 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <iostream>
  2. using namespace std;
  3. string giveName(unsigned int size = 7);
  4. int main() {
  5. cout << "Minion's name generator!" << endl;
  6. cout << "provided by Jovian Hersemeule" << endl << endl;
  7. srand(time(0));
  8. for (int k(0); k < 5; k++) {
  9. cout << "Minion " << k + 1 << " : " << giveName() << endl;
  10. }
  11. return 0;
  12. }
  13. string giveName(unsigned int size) {
  14. string voyel("aeiou");
  15. string conson("bcdfghjklmnpqrstvwxyz");
  16. string newName;
  17. for (int k(0); k < size; k++) {
  18. if (k % 2) { // Voyelle
  19. newName.append(1, voyel[rand() % voyel.length()]);
  20. } else { // Consonne
  21. newName.append(1, conson[rand() % conson.length()]);
  22. }
  23. }
  24. newName[0] = toupper(newName[0]);
  25. return newName;
  26. }