Created
May 23, 2021 12:25
-
-
Save SnowyPainter/3d249d8194dfc853e97ad6da94ca77ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct dllitem { | |
dllitem * prev; | |
dllitem * next; | |
float value; | |
}; | |
class floatDLL | |
{ | |
private: | |
dllitem* newitem(float value, dllitem* next, dllitem* prev) { | |
auto item = new dllitem(); | |
item->value = value; | |
item->next = next; | |
item->prev = prev; | |
return item; | |
} | |
dllitem * head, * current; | |
public: | |
floatDLL() { | |
head = nullptr; | |
current = nullptr; | |
} | |
void Delete(int i) { | |
//찾기 - 절개 - 삭제 - 봉합 | |
} | |
void Add(float value) { | |
if(head == nullptr) { | |
head = new dllitem(); | |
head->next = nullptr; | |
head->prev = nullptr; | |
head->value = value; | |
current = head; | |
return; | |
} | |
auto item = newitem(value, current, nullptr); | |
current->prev = item; | |
current = item; | |
} | |
void Insert(int i, float value) { | |
//절개 - 삽입 - 봉합 | |
} | |
void Update(int i, float value) { | |
//찾기 - 변경 | |
} | |
void printall() { | |
dllitem * current = head; | |
while(current != nullptr) { | |
cout << current->value << endl; | |
current = current->prev; | |
} | |
} | |
}; | |
int main() | |
{ | |
floatDLL dll = floatDLL(); | |
for(int i = 0;i < 10;i++) | |
dll.Add(i); | |
dll.printall(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment