看板 EE_DSnP 關於我們 聯絡資訊
※ 引述《popo4231 (小泰)》之銘言: : 關於#homework3的幾個問題 : 1:請問string可以用什麼方法轉換成int嗎 : static_cast<int>(string物件)的方法compile不給過 For "static_cast", FYI: http://msdn2.microsoft.com/en-us/library/ms861534.aspx In short, it can convert integral type to integral type, floating to floating, pointer to pointer, but not mixed. You can try--- string str = ......; char* strChar = str.c_str(); int i = atoi(strChar); // but only good for 32-bit integer : 2:可以宣告member function中區域變數為long lnog : 但是data member中只有unsigned int嗎 不行... 這樣子就沒有意義了. : 3:可以用字元陣列嗎 可以, 但請考慮 memory 與 runtime efficiency. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.21.241
flarehunter:老師說的考慮memory 是所有的memory不能超過64bit嗎?! 10/19 07:59