help!

Started by
3 comments, last by scitmon 18 years, 8 months ago
I'm using Borland C++ and i cant figure out how to fix the following:
 

char tempIntHolder[10];
string tempCharHolder;
string wholeDeck[52];

for(i = 0; i <= 51; i++) 
{
    tempCharHolder = deck::deckLetter;
    sprintf(tempIntHolder, "%i", deck::deckNumber);
    deck::wholeDeck = tempIntHolder + tempCharHolder;
}

Error is "LValue required" on the 3rd line in the for loop can anyone help me?
Advertisement
Your "wholedeck" is an array of strings. You need to access a single element of the array using square braces

deck::wholeDeck = tempIntHolder + tempCharHolder;

If you don't know what that means, ask and I (or someone else) will explain better.
wholeDeck is an array of strings ...and what is deck?
Quote:Original post by Caminman
wholeDeck is an array of strings ...and what is deck?


Is it a namespace, struct or class?

If it's either a struct or a class, you'd be better off creating an instance of it, e.g.

deck CardDeck


then

tempCharHolder = CardDeck.deckLetter;sprintf(tempIntHolder, "%i", CardDeck.deckNumber);CardDeck.wholeDeck = tempIntHolder + tempCharHolder;


HTH,

ukdeveloper.

its ok, the first reply solved my error, thanks guys! :)

This topic is closed to new replies.

Advertisement