Strings

I need help with a string statement in my code.
I'm trying to make a program like Scrabble Flash(if you don't know what that is, it's a game with scrambled letters and you have to guess the word.)

Well, the code is kind of long, so im not going to show you the whole thing. Besides strings, I get no errors. Here's the part of my code that refers to strings. (there are other parts, so dont think im stupid for trying to run a program out of this) The error im getting is 'kill' undefined (first use his function)

It's not a good idea to get used at having global variables. Creating an array of strings and passing it together with an int to Random() would be a better solution. This also lets you reduce the function to simply

Note that in your current code, the result of rand() can be 0, leading to Random() not doing anything. You should either write rand() % 10 + 1 or make the condition start from 0. If you use the array then you NEED to have it starting from 0

This "kill"-named string and the others one here will only be available within Dictionary, but not from other functions.
If you want to use them into other functions you can declare them outside:

12

string kill = // .....
string another = // .....

As someone else (maeriden) pointed out you can, to simplify things, use a table of string:

123456789101112131415161718192021222324252627282930313233343536

string Table[] = {
"likl",
"xett",
// add others here, as many as you want as long as your RAM can handle them obviously, LOL.
};
constunsignedint TableSize = sizeof(Table) / sizeof(string);
// TableSize is the Amount of Strings there are in Table[].// Then into random:void Random(constunsignedint& ID)
// the 'unsigned' means "You cannot go under 0"// Also if you only need to "read" ID and not modify it,// also use the 'const' keyword, or it will make things harder.
{
if(ID < TableSize) // Just make sure the ID is a good one.
cout << Table[ID] << endl;
}
int main() // you don't need void, it was only needed in C.
{
srand((size_t)time(0)); // This is called Seeding the Rand.// Now, each time you run the program, you will get a different result,// Because you are seeding the program with the current system time.int random = rand() % TableSize;
Random(random); // This is one way to do it
Random( rand() % TableSize ); // This is another./* Another note is:
In your example
'void Random (int &random)'
you cannot do the second call ( The one i commented with "this is another".
If you wanted to do so, you should have used:
'void Random (const int &random)'
*/
}

@EssGeEich,
I've done some research on what you've said, and it seems like you know what you're talking about. But, the code you gave me only ended up with another problem. In int main(), I start off the game by doing:

Because that's not how you call a function.
You call it like it was another function.
Because you're not calling sleep like this:void sleep(unsignedlong);
but you are calling it like:sleep(value)
So, instead of writingvoid Random(constunsignedint& ID);
you must writeRandom( rand() % TableSize );

(Look closely, I made you an example in the post over!! Read it, Lol!)

EDIT: Also, a couple of suggestion to use in future:
Use a unscrambled-list of words and mix them up at runtime.
Check the answer case-insensitively.