我有大量的數據集。我希望使用數組來存儲這些數據。更詳細地說,如何爲3個數據集創建多級MAP
在我的數組中,我想使用3列,如Number number_of_points point_numbers
。爲此,我可以創建一個類似mypointstore[][]
的數組(例如mypointstore[20][3]
)。但我的問題是,我想存儲第3列的點數,如20, 1, 32, 9, 200, 12
等(mypointstore[0][0]= 1
,mypointstore[0][1]= 6
和mypointstore[0][2]={ 20, 1, 32, 9, 200, 12 }
)。我不知道這種結構使用數組是否可行?如果是這樣,請幫我解決這個問題。
我試圖使用地圖像map<int,int,vector<int>> mypointstore;
但我不知道如何插入數據到這張地圖; 我的一些代碼在這裏
map<int,int, vector<int>> mypointstore;
size=20;
For (int i=0; i<= size;i++){
Int det=0;
For (int j=0; j<= points.size();j++){//points is a one of array with my points
If (points.at(j)>Z1 && points.at(j) <=Z2){
//Here i want to store i , det and poiznts.at(j) like i in 1st colum, det in 2nd and
//pointnumber in 3rd colum) in each step of the loop it take a point
//number //which satisfied the if condition so it should be include into my
// vector of map
det++;
}
}
// at here i want to change total det value into 2nd element of my map so it like (0)(6)(20, 1, 32, 9, 200, 12)
}
下一步
類似的過程,以便finaly應該
(0)(6)(20, 1, 32, 9, 200, 12)
(1)(10)(20, 1, 32, 9, 200, 12, 233, 80, 12, 90)
(2)(3)(3, 15, 32)
我整理了一下你的文章,但不是你的代碼。你有幾個錯誤。 ''不''''''不'''''不''''如果''不'''''''''''''',非常差的縮進,太多的'std :: map'模板參數'矢量'不是比較器)。 –
2011-04-06 14:04:30
不,我不知道如何在這裏發佈代碼 – nah 2011-04-08 12:00:23
有一大堆的建議,信息和鏈接到更多的問題在你寫的問題的框的右側。我描述的問題是關於代碼本身。 – 2011-04-08 12:17:21