#include <iostream>
#include <string>
#include <vector>
usingnamespace std;
vector<string> names;
int Play = 1;
void check_name (const string & input)
{ for(size_t i = 0; i < names.size(); i++)
{ if (input == names[i])
{ Play = 0;
}
}
}
int main()
{ string Input;
cout << "Welcome to the Fake Name Generator Game" << endl;
cout << "Press <Any> Key To Start" << endl;
cin >> Input;
do
{ cout << "Type A New Name: " << flush;
cin >> Input;
names.push_back (Input);
check_name(Input);
} while (Play == 1);
cout << "Game Over" << endl;
system ("pause");
}
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.