string[] b={ " "," x "," y "," z " };
那麽b[1]是“x”,b[2]是Y,b [3]是z。
如果1.2.3和x.y.z只是妳的例子,現實中沒有規律,那就用字典比較快,比如。
字典& ltstring,string & gtdic =新詞典& ltstring,string & gt();
dic。Add("1 "," x ");
dic。Add("2 "," y ");
dic。Add("3 "," z ");
然後用dic["1"]得到" X "。