Browse Source

Import name generator

DricomDragon 4 years ago
parent
commit
8f3e648179
1 changed files with 37 additions and 0 deletions
  1. 37 0
      nameGenerator/main.cpp

+ 37 - 0
nameGenerator/main.cpp

@@ -0,0 +1,37 @@
+#include <iostream>
+
+using namespace std;
+
+string giveName(unsigned int size = 7);
+
+int main() {
+    cout << "Minion's name generator!" << endl;
+    cout << "provided by Jovian Hersemeule" << endl << endl;
+
+    srand(time(0));
+
+    for (int k(0); k < 5; k++) {
+        cout << "Minion " << k + 1 << " : " << giveName() << endl;
+    }
+
+    return 0;
+}
+
+string giveName(unsigned int size) {
+    string voyel("aeiou");
+    string conson("bcdfghjklmnpqrstvwxyz");
+
+    string newName;
+
+    for (int k(0); k < size; k++) {
+        if (k % 2) { // Voyelle
+            newName.append(1, voyel[rand() % voyel.length()]);
+        } else { // Consonne
+            newName.append(1, conson[rand() % conson.length()]);
+        }
+    }
+
+    newName[0] = toupper(newName[0]);
+
+    return newName;
+}