看板 NTUBIME104HW 關於我們 聯絡資訊
※ [本文轉錄自 NTUBIME103HW 看板 #1D0vIfeb ] 作者: steve1012 (steve) 看板: NTUBIME103HW 標題: [C++ ] 字串處理 時間: Sat Dec 11 23:11:35 2010 這提其實很簡單 問題應該都是ctrl+Z吧 我的方法是這樣 while(cin) 當你輸入ctrl+z 在壓enter他就會跳出了 寫法如下(記得include string) void main() { string str1; while(cin) { getlin(cin,str1); for(int i=str1.length()-1;i>-1;i--) cout<<str1.at(i); cout<<endl; } return 0; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.34.202.142 ※ 發信站: 批踢踢實業坊(ptt.cc) ※ 轉錄者: g85101878 (140.112.218.137), 時間: 12/10/2011 01:09:08
Gordon078 :哦~~好樣的 不過為什麼會這樣啊= =? 12/10 10:18