I did a little debugging and i found that everything in my program works fine until i call this function, the function is supposed to set variables inside the struct to whatever color they need to be but they are coming up empty in cout.
Edit: Did some more debugging and found that p1name comes up as "". (Empty)
In the determinecolors function you create a new playerid object. The member variables p1color, p2color, p3color, etc. will be uninitialized when you try to use them in the switches. When the function ends the object is destroyed.
The function seems pointless as it is. Did you mean to pass the object as argument to the function and/or return the object from the function, perhaps?
You're not showing us the cout, which I assume is in your main function and not in determinecolors. If that's the case, the problem is line 22. Your playid struct is local within determine colors. That variable goes out of scope and changes to it are lost when the function exits. You need to pass in the playerid struct from main as an argument by reference.
BTW, Your really shoud treat playerid as an array. You're repeating essentially the same code 8 times. Consider this:
struct playerid{
int p1color;
int p2color;
int p3color;
int p4color;
int p5color;
int p6color;
int p7color;
int p8color;
string p1name;
string p2name;
string p3name;
string p4name;
string p5name;
string p6name;
string p7name;
string p8name;
};
playerid idkey;
And before i had just the entire contents of the determinecolor function inside my main function but instead was using int's declared inside main instead of a struct. Really i did it to try to organize better rather than have 500 lines of code all inside my main().