Jump to content
  • Advertisement
Sign in to follow this  
Rubiks14

question about multi arrays

This topic is 4637 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

how do you make a multidimentional array that has...lets say a column of strings and a column of integers? thanks, Rubiks14

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Rubiks14
how do you make a multidimentional array that has...lets say a column of strings and a column of integers?

thanks, Rubiks14

Just how do you want to interact with this array? A std::map<...> might be what you're looking for, but I'd need more details to help more.

Share this post


Link to post
Share on other sites
ok i'm wanting to set up a multidimensional array that has in column 1 what the item is and in column 2 what the price of that item is (i'm just making kind of like a market for rpg just for some practice)

P.S. i'm also just wanting to use something that is in the area of what all i know. i just got through reading chap 3 in Beginning C++ Game Programming so basically the extint of my knowledge is multidimensional arrays

Share this post


Link to post
Share on other sites
Sounds like what you want is:


struct rpg_item
{
std::string item;
int cost;
};

std::vector< rpg_item > item_list;

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!