Answer by Animesh Kumar Paul for multi-dimensional array of 2 types cpp
You can use:Sample Code: using Pairvector <pair <string, double> > test;test.push_back(make_pair("Age",15.6));test.push_back(make_pair("Job",5));cout <<...
View ArticleAnswer by NathanOliver for multi-dimensional array of 2 types cpp
You cannot have different types in an array. If you need to have two different types there are several ways you can do thatYou can use a std::pair like: std::pair<std::string, double>You can use...
View ArticleAnswer by nsubiron for multi-dimensional array of 2 types cpp
Use an array of std::pair or your own defined struct/class. Or if you require searching consider using std::map instead.
View ArticleAnswer by Tokay for multi-dimensional array of 2 types cpp
You can use pair, but you have to give the size of this array.. For example:std::array<std::pair<std::string, double>, 3> dummy{{"string", 1.1}, {"foo", 2.2}, {"bar", 3.3}};You can then...
View Articlemulti-dimensional array of 2 types cpp
this question is on c++. How can I make an array that, in first row has strings and in second row has doubles? I think it should be void but its not working. Is there any other way? Cheers
View Article