[問題] 要怎麼取出map的資料

看板C_and_CPP作者 (iamaee)時間16年前 (2009/11/06 18:43), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
我宣告了一個二維map typedef map<string, string > mmid; typedef map<string, mmid > mid; mid rowVectors; 然後放了很多的資料進去 最後我要用迴圈取出某一列的值 結構大概是這樣: index:str1 str2 str3 index2:str1 str2 str3 . . . 我是這樣寫 map<string, string >::iterator iter; for(iter =rowVectors["index"].begin(); iter! =rowVectors["index"].end();++iter) { printf("(*iter).second)=%s\n",(*iter).second); } compile會過 但是不會進入迴圈執行 請問是哪邊想錯了嗎? (我是用Dev-c) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.30.84

11/06 20:31, , 1F
確定 "index" 有 value 嗎?(而且這樣好慢 QQ)
11/06 20:31, 1F
文章代碼(AID): #1Ay_ss-j (C_and_CPP)