作者song1st (幻天)
看板HSJH_90_302
標題Re: 急~~~尋求C程式達人
時間Wed Oct 25 17:47:49 2006
※ 引述《askygirl (我討厭失眠啦)》之銘言:
: ※ 引述《askygirl (我討厭失眠啦)》之銘言:
: : 我的作業要爆了
: : 誰可以幫幫我 嗚嗚
: : 寫有關linklist的program
: 我看見救星了嗎@@ 貓大大~~
: 我放在我的ftp http://plum.cs.nccu.edu.tw/~s9325
: data structer assign1
: array已經寫好 還有linked list沒寫
用struct YH 去儲存每筆資料
使用者輸入資料後即送到save()去儲存
依據旅館的name去實作3家店linked list(*head[3],*tail[3]=>指到三家店list的頭尾)
0代表旅館a的linked list
1代表旅館b的linked list
2代表旅館c的linked list
利用sort_list()去將三個list的依price由小到大排序
ex:輸入
a 1 201 3 3000
b 1 201 4 5000
c 1 101 4 4000
c 1 51 2 2500
a 21 51 4 4000
a 101 301 2 2000
c 101 365 3 3000
b 101 365 2 2500
a 201 365 1 1000
排序後:
a家
a 201 365 1 1000
a 101 301 2 2000
a 1 201 3 3000
a 21 51 4 4000
b家
b 101 365 2 2500
b 1 201 4 5000
c家
c 1 51 2 2500
c 101 365 3 3000
c 1 101 4 4000
然後呼叫cheapest_YH()
利用cheap_price[3][366]
去儲存每家店每天最便宜的price及class
然後再去算出每家店住整年度最便宜的店家
然後輸出最後結果
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.138.252.122
推 megadevil:這是火星文嗎 果真是術業有專攻 10/25 23:21
推 syhy:= = 唉...我也有修C++但是我過了也是一個東西都寫不出來 10/25 23:50
推 askygirl:程式這種東西...囧 10/26 00:58