我試圖從csv文件中讀取數據到一個結構向量中,每個結構都包含足球比賽中的各種值(進攻球隊,季度,下場,場地, desc等)。我試圖使用stringstream將字符串轉換爲整數,但我返回垃圾數據。從CSV文件中讀取數據後,將字符串轉換爲int
[email protected],1,47,25,IND,NO,1,10,31,(2:25) J.Addai up the middle to NO 27 for 4 yards (S.Fujita).,0,0,2007
[email protected],1,46,42,IND,NO,2,6,27,(1:42) P.Manning pass deep left to M.Harrison for 27 yards TOUCHDOWN.,0,0,2007
我的程序返回的數據是這樣,當我嘗試相關的輸出一切:
Game ID: [email protected]
Offensive team: IND
Quarter: 7077994
Down: 4696320
To go: 4670480
Play: (2:25) J.Addai up the middle to NO 27 for 4 yards (S.Fujita).
Game ID: [email protected]
Offensive team: IND
Quarter: 7077994
Down: 4696320
To go: 4670480
Play: (1:42) P.Manning pass deep left to M.Harrison for 27 yards TOUCHDOWN.