-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbongo.cpp
More file actions
25 lines (21 loc) · 736 Bytes
/
bongo.cpp
File metadata and controls
25 lines (21 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <cstdlib>
#include <ctime>
const std::string VOWELS[5] = {"a","i","e","o","u"};
const std::string WORDS_FORMAT[7] = {"b+ng+s", "b+b+s", "b+nt+d", "b+t+s", "b+t+b", "b+b+s", "!"};
std::string getVowel() { return VOWELS[std::rand()%4] ;}
std::string getWord(){
std::string chosen_format = WORDS_FORMAT[std::rand()%7];
std::string buffer = "";
for(int i = 0; i < chosen_format.length(); i++){
if (chosen_format[i] == '+'){ buffer += getVowel();}
else {buffer += chosen_format[i];}
}
return buffer;
}
int main(int argc, char** argv){
std::srand(std::time(nullptr));
for(int i = 0; i < 100; i++){
std::cout << getWord() << " ";
}
}