Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write 3d mapping in C++?

Tags:

c++

mapping

Can you please tell me how I can write multidimensional map. For two dimensional map, I did the following:

map<string, int> Employees
Employees[“person1”] = 200;

I was trying to use something similar to following for 3d mapping.

map<string, string, int> Employees;
Employees[“person1”, “age”] = 200;

Can you please tell me the correct way to do this?

and Is there a way I can initialize all the map elements to be 0 ? Just like on a array we can say int array[10]={0};

like image 287
Learner_51 Avatar asked Feb 12 '12 10:02

Learner_51


People also ask

What is 3D mapping?

3D mapping technology uses machine vision to aid in profiling objects in three dimensions to map them in the real world, providing the latest technical methods for visualisation and information acquisition. 3D mapping requires the profiling of objects in three dimensions to map those objects in the real world.

Can a map have 3 elements in C++?

You cannot have three elements. The STL map stores a key-value pair. You need to decide on what you are going to use as a key.

What is map in C?

What is a map in C++? A C++ map is a way to store a key-value pair. A map can be declared as follows: #include <iostream> #include <map> map<int, int> sample_map; Each map entry consists of a pair: a key and a value.


1 Answers

You need to create map of maps like that.

map<string, map<string, int> > employees;
employees["person1"]["age"] = 200;
like image 189
Boris Strandjev Avatar answered Sep 27 '22 21:09

Boris Strandjev