Hey you guys i have a major problem here basically im a begginer c++ program student and i am trying to get use to vectors and functions so i made this program like a mad lib game or a bear hunt as you say. The program basically have vectors (duh) were the user inputs five verbs, nouns, items, etc. into the vectors then the vectors would then put the story i made in random places but i don't know how to random my vectors please help me :D Here is my code:
// Bear Hunt.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <string>
#include <ctime>
#include <cstdlib>
#include <algorithm>
using namespace std;
void Welcome();
int menu();
void Genova();
void Menu();
void Jebusland();
int main()
{
cout << "\t\t\Welcome to The Pendragon Bear Hunt!! \n\n";
string item;
string verb;
string noun;
int count = 0;
Welcome();
while
(count != 3)
{
count = menu();
if
(count == 1)
{
Genova();
}
else
if(count == 2)
{
Jebusland();
}
}
return
0;
}
void Welcome()
{
int
number;
cout <<
"....Beware!! the planet of Jenova!!!\n\n\n";
cout <<
"Please follow the instructions to countiue..";
cout <<
"What planet would you like to go to\n";
cout <<
"1.Genova\n";
cout <<
"2.Jebus Land \n";
cin >> number;
if
(number == 1)
{
Genova();
}
else
if(number == 2)
{
Jebusland();
}
return
;
}
void Genova()
{
string item;
string verb;
string noun;
vector<string>items;
for
(int i = 0; i < 5; ++i)
{
cout <<
"Type in five items: \n\n";
cin >> item;
items.push_back(item);
}
srand(time(0));
random_shuffle(item.begin(), item.end());
vector<string>verbs;
for
(int i = 0; i < 5; ++i)
{
cout <<
"Type in five verbs: \n\n";
cin >> verb;
items.push_back(verb);
}
vector<string>nouns;
for
(int i = 0; i < 5; ++i)
{
cout <<
"Type in five nouns: \n\n";
cin >> noun;
items.push_back(noun);
}
cout << item;
cout << "now the leader of all of the travelers are now establishing a new planet\n\n";
cout << "Inside of our Solar System located were Second Earth would be.";
cout << item;
cout << "To go with the idea but it wasnt a easy debate. Many other travelers wanted it to be part of the Veelox. Most of the people decided to they wanted it by\n\n";
cout << "Cloral for reasonable economical reasons. But Bobby decided to change to change the location from Second Earth\n\n";
cout << "To Dendourn his first area were he started traveling at his age. It was perfect for him he loved that idea. But\n\n";
cout << "What is the name of the planet and for what purpose is it being created.\n\n";
cout << "Bobby called it 'Genova' the planet of source\n\n";
cout << "Bobby has discoverd that he can fuse materia with the inner core of other planets to make a unique source";
cout << "He wanted to insert the materia with a star and produce a Big Bam Theory sort of use to it";
cout << "Then he would send special-ops travelers that would search the planet and discover any interference with the planets production like";
cout << "Quigs, Animals, or Beings of sorts that have been inhabited inside the planet";
}
void Jebusland()
{
string item;
string verb;
string noun;
vector<string>items;
for
(int i = 0; i < 5; ++i)
{
srand(time(0));
cout << "Type in five items: \n\n";
cin >> item;
items.push_back(item);
}
for
(int i = 0; i < 5; ++i)
{
cout <<
"Type in five verbs: \n\n";
cin >> verb;
items.push_back(verb);
}
vector<string>nouns;
for
(int i = 0; i < 5; ++i)
{
cout <<
"Type in five nouns: \n\n";
cin >> noun;
items.push_back(noun);
}
cout << "Jebusland was a planet of peace until a vessel landed";
cout << item;
cout << "Inside of that vessel lived hordes of bears from there planet second earth";
cout << item;
cout << "What the travelers didnt know that the bear race was full of highly intelligent bears that surpass any human being and were far ahead in technology";
}
int
menu()
{
int
choice;
cout << "\n\nWhat planet would you like to go to\n";
cout << "\n1. Go to Genova \n";
cout << "2. Go to Jebusland \n";
cout << "3. Quit \n";
cin >> choice;
return
choice;
}