question about multi arrays

Started by
10 comments, last by Conner McCloud 18 years, 4 months ago
how do you make a multidimentional array that has...lets say a column of strings and a column of integers? thanks, Rubiks14
Advertisement
In what language?
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid
sry bout that. C++
You can't. Arrays are homogeneous containers.
well that sucks...guess i'll have to use if statements

thanks anyway...saved me some stress :D
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.
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid
You could use an array of void*
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
Sounds like what you want is:

struct rpg_item{    std::string item;    int         cost;};std::vector< rpg_item > item_list;
ummm...yea...i dunno what half of that means...i'm not that far in my book

This topic is closed to new replies.

Advertisement