國立屏東大學 資訊工程學系 程式設計(二)
turnin code c.hw17
due date: June 17, 13:30
* 延續上次的作業16
* 本次作業要turnin三個檔案
* 如果你設計remove()函式時,遇到函式名稱重複定義的問題,可以將revmoe()改名為removeElement()或其它你喜歡的名稱
使用Linked List來存放不定個數,長度亦不限定的新版本stringBox。請將LinkedList相關的宣告寫在stringLL.h中,實作寫在stringLL.c中,並以一含有main function的主程式stringLLBox.c完成以下功能。注意:關於Linked List部份依課堂講解的功能為主,但你必須將原本可儲存整數的功能,改成字串(其長度不固定)。在你的程式中,必須宣告一個指標永遠指向目前字元數最長的字串,如果一樣時,則列出最後加入的字串。程式執行時,可接受使用者命令進行相關操作,包含:
程式執行結果參考:
[9:19 user@ws hw17] ./a.out [command] l -empty- [command] m -null- [command] q -bye- [9:19 user@ws hw17] ./a.out [command] l -empty- [command] i string=? Happy [command] l Happy-->end [command] i string=? birthday [command] i string=? to [command] i string=? someOneWithAVeryVeryLongName [command] l Happy-->birthday-->to-->someOneWithAVeryVeryLongName-->end [command] m The string with maximum length is someOneWithAVeryVeryLongName. [command] s string=? to found [command] s string=? XXX none [command] d string=? someOneWithAVeryVeryLongName deleted [command] l Happy-->birthday-->to-->end [command] i string=? You [command] l Happy-->birthday-->to-->You-->end [command] i string=? You [command] l Happy-->birthday-->to-->You-->You-->end [command] d string=? You deleted [command] l Happy-->birthday-->to-->end [command] i string=? You [command] l Happy-->birthday-->to-->You-->end [command] e [command] l -empty- [command] q -bye- [9:19 user@ws hw17]