Advertisement Jump to content
Sign in to follow this  
scitmon

help!

This topic is 4903 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!