Hi, i'm a newbie too, but ... what does it print out though ?
... and maybe the Index is zero-based (?). Why not declaring card[0] ? And why do you declare card[52] ?
I'm not sure about all that, because "card" is global, or ?
Maybe declare it inside the main function and let "loaddeck" manipulate it (call by reference) ... ?
That's what i would do, but i'm a newbie too, so ... no warranity ...
And put away the "void" before the call to "loaddeck", it's only needed in declarations, and your "call" to "loaddeck" maybe IS a declaration like this (? also not sure, but it's worth trying, i guess)
As fluppe says, you don't actually call loadDeck() in main() so the program doesn't load the card names and values into the array.
1 2 3 4 5 6 7 8 9
int main(){
setlocale(LC_ALL,"swedish");
//srand (unsigned int(NULL));
loadDeck(); /// get rid of the void here.
cout << card[1].name <<"\n"<<card[1].value<<endl;
cin.get();
return 0;
}
Now once you do this the program will enter your loadDeck() function but you will get maybe a crash.
Again as fluppe said, arrays start at index 0, i.e. card[0].
This means the last index of an array of 52 elements is 51, i.e. card[51].
With card[52] you are trying to access memory that is not part of the array (out of bounds).
To stop this you can redo the loadDeck() function to start at card[0] which is a lot of work or just make the array 53 elements long and never use card[0].
That is,
1 2 3 4 5
struct card{
string name;
int value;
bool locked;
}card[53];/// change to 53