[問題] 字串的排序
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
C
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
string.h
問題(Question):
將標準輸入的各行字串照字母順序排序
可是在執行到一半的時候就發生錯誤了
餵入的資料(Input):
candy
apple
cat
banana
預期的正確結果(Expected Output):
apple
banana
candy
cat
錯誤結果(Wrong Output):
發生錯誤,執行失敗
程式碼(Code):(請善用置底文網頁, 記得排版)
http://ideone.com/3T4ZPL
補充說明(Supplement):
我自己試的時候發現
好像是strcmp那邊發生了問題
不知道是不是strcmp不能這樣用
我剛接觸程式不到3個月,可能犯下很多低級錯誤
還望指教!感謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 49.215.66.203
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1449741756.A.809.html
※ 編輯: alen0303 (49.215.66.203), 12/10/2015 18:05:56
推
12/10 18:12, , 1F
12/10 18:12, 1F
→
12/10 18:12, , 2F
12/10 18:12, 2F
→
12/10 18:13, , 3F
12/10 18:13, 3F
→
12/10 18:13, , 4F
12/10 18:13, 4F
→
12/10 18:13, , 5F
12/10 18:13, 5F
→
12/10 18:14, , 6F
12/10 18:14, 6F
→
12/10 18:14, , 7F
12/10 18:14, 7F
→
12/10 18:15, , 8F
12/10 18:15, 8F
哦哦 大概懂意思了 感謝!!
※ 編輯: alen0303 (49.215.66.203), 12/10/2015 18:18:52
推
12/10 22:06, , 9F
12/10 22:06, 9F
推
12/11 13:23, , 10F
12/11 13:23, 10F