Stonewall382
Knight at Arms

Hi, I just need the syntactically correct code for an initialization function inside a data structure please. I can't find it online, and my book is lost in my room. We haven't gotten to this yet in class, but it would really help for a program I'm making. My current code (won't compile) looks like this:
Thank you to anyone who helps--it's much appreciated.
I'll delete this when I get an answer or figure it out myself.
D'oh! I think I just got it:
插入代码块:
struct FighterNames
{
string HomieNames [NUM_HOMIE_NAMES];
string CopNames [NUM_COP_NAMES];
void InitNames
{
HomieNames = ["Tim", "Don", "Steve"];
}
};
Thank you to anyone who helps--it's much appreciated.
I'll delete this when I get an answer or figure it out myself.
D'oh! I think I just got it:
插入代码块:
struct FighterNames
{
string HomieNames [NUM_HOMIE_NAMES];
string CopNames [NUM_COP_NAMES];
void InitNames ()
{
HomieNames [0] = "Tim";
HomieNames [1] = "Don";
HomieNames [2] = "Steve";
}
};

