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
|
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
int random(unsigned limit)
{
return rand() % limit;
}
string getRandom(string s[], unsigned size)
{
return s[random(size)];
}
static string getWorldName(){
string first[10] = { "Wicked", "Epic", "Blue", "Horrible", "Soft", "Lol", "Fallen", "Wild", "Calm", "Fierce" };
string second[9] = { "Corn", "Horse", "Man", "Cheese", "Forest", "Shade", "Box", "Waterwheel", "Village" };
string third[3] = { "Mountains", "Fields", "Shores" };
string world_name = getRandom(first, 10) + " " + getRandom(second, 9) + " " + getRandom(third, 3);
return world_name;
}
int main()
{
std::srand(time(0));
for (unsigned i = 0; i < 10; ++i)
std::cout << getWorldName() << '\n';
}
|