Showing
2 changed files
with
13 additions
and
11 deletions
... | @@ -182,6 +182,16 @@ void Application::Delete() | ... | @@ -182,6 +182,16 @@ void Application::Delete() |
182 | MusicType data; //Delete함수는 MusicType을 파라미터로 갖기 때문에 임의로 만들어준다. | 182 | MusicType data; //Delete함수는 MusicType을 파라미터로 갖기 때문에 임의로 만들어준다. |
183 | data.SetNumFromKB(); //사용자에게서 곡 번호를 입력받는다. | 183 | data.SetNumFromKB(); //사용자에게서 곡 번호를 입력받는다. |
184 | SearchByIndex(data); | 184 | SearchByIndex(data); |
185 | + DoublyIter2<ManageType> Mgiter(mg_List); | ||
186 | + while (Mgiter.NotNull()) | ||
187 | + { | ||
188 | + if (Mgiter.GetCurrentNode().data.getIndex() == data.GetNum()) | ||
189 | + { | ||
190 | + ManageType* mgptr = Mgiter.GetCurrentPtr(); | ||
191 | + mgptr->Deleted(); | ||
192 | + } | ||
193 | + Mgiter.Next(); | ||
194 | + } | ||
185 | /*DoublyIter<MusicType> Miter(m_List); | 195 | /*DoublyIter<MusicType> Miter(m_List); |
186 | if (data.GetNum() < 1 || data.GetNum() > m_List.GetLength()) | 196 | if (data.GetNum() < 1 || data.GetNum() > m_List.GetLength()) |
187 | return; | 197 | return; |
... | @@ -195,16 +205,8 @@ void Application::Delete() | ... | @@ -195,16 +205,8 @@ void Application::Delete() |
195 | cout << "\t삭제를 완료했습니다." << endl; //삭제에 성공했으면 메시지를 출력한다. | 205 | cout << "\t삭제를 완료했습니다." << endl; //삭제에 성공했으면 메시지를 출력한다. |
196 | RemakeSubList(); //MusicList에 변화가 생겼으므로 하위 리스트들을 다시 만들어줘야 한다. | 206 | RemakeSubList(); //MusicList에 변화가 생겼으므로 하위 리스트들을 다시 만들어줘야 한다. |
197 | 207 | ||
198 | - DoublyIter2<ManageType> Mgiter(mg_List); | 208 | + |
199 | - while (Mgiter.NotNull()) | 209 | + |
200 | - { | ||
201 | - if (Mgiter.GetCurrentNode().data.getIndex() == data.GetNum()) | ||
202 | - { | ||
203 | - ManageType* mgptr = Mgiter.GetCurrentPtr(); | ||
204 | - mgptr->Deleted(); | ||
205 | - } | ||
206 | - Mgiter.Next(); | ||
207 | - } | ||
208 | if (m_List.GetLength() != 0) //길이가 0이면 인덱스를 부여할수 없다. | 210 | if (m_List.GetLength() != 0) //길이가 0이면 인덱스를 부여할수 없다. |
209 | { | 211 | { |
210 | SetMusicIndex();//MusicList에 변화가 생겼으므로 Index를 다시 부여한다. | 212 | SetMusicIndex();//MusicList에 변화가 생겼으므로 Index를 다시 부여한다. | ... | ... |
... | @@ -288,7 +288,7 @@ int SortedLinkedList<T>::Delete(T& data) | ... | @@ -288,7 +288,7 @@ int SortedLinkedList<T>::Delete(T& data) |
288 | int positionIndex = Get(data); | 288 | int positionIndex = Get(data); |
289 | if (positionIndex) | 289 | if (positionIndex) |
290 | { | 290 | { |
291 | - for (int i = 1; i < positionIndex; i++) | 291 | + for (int i = 1; i <= positionIndex; i++) |
292 | pNode = pNode->next; | 292 | pNode = pNode->next; |
293 | 293 | ||
294 | if (pNode->next != NULL) | 294 | if (pNode->next != NULL) | ... | ... |
-
Please register or login to post a comment