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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include <iostream>
#include <string>
#include <ctime>
using namespace std;
//The standard muster is : personal pronoun + verb + adjective + noun
// arrays
static const string pronoun[] = { "I", "You", "He", "She", "It", "We", "You", "They" };
static const string verb[] = {"like", "jump", "enjoy", "prefer", "chill", "works"};
static const string adjective[] = {"big", "tall", "small", "colorful"};
static const string noun[] = {"Trains", "Houses", "Apples", "Bananas", "Cities"};
// numbers for random
int pronounLength = sizeof(pronoun)-1;
int verbLength = sizeof(verb)-1;
int adjectiveLength = sizeof(adjective)-1;
int nounLength = sizeof(noun)-1;
string genPronoun() // Random string generator function.
{
return pronoun[rand() % pronounLength];
}
string genVerb() // Random string generator function.
{
return verb[rand() % verbLength];
}
string genAdjective()
{
return adjective[rand() % adjectiveLength];
}
string genNoun()
{
return noun[rand() % nounLength];
}
int main()
{
srand(time(0)); // initialize random
cout << genPronoun() << genVerb() << genAdjective() << genNoun();
cout << endl;
system("Pause");
}
|