diff --git a/ASD_Task_2.depend b/ASD_Task_2.depend index 4a87b2d..e7e0b20 100644 --- a/ASD_Task_2.depend +++ b/ASD_Task_2.depend @@ -29,3 +29,21 @@ "list.h" "operation.h" +1581258151 source:c:\users\azizah cahya\documents\github\asd_task_2\operation.cpp + "list.h" + "operation.h" + +1581236206 c:\users\azizah cahya\documents\github\asd_task_2\list.h + + +1581232271 c:\users\azizah cahya\documents\github\asd_task_2\operation.h + "list.h" + +1581237744 source:c:\users\azizah cahya\documents\github\asd_task_2\main.cpp + + "list.h" + "operation.h" + +1581259785 source:c:\users\azizah cahya\documents\github\asd_task_2\list.cpp + "list.h" + diff --git a/Main.cpp b/Main.cpp index 297d6ca..f3dfaf8 100644 --- a/Main.cpp +++ b/Main.cpp @@ -34,7 +34,7 @@ int main() { //================================================== // TEST INSERT AFTER P = findElm(L, 6); - insertLast(L, allocate(5)); + insertAfter(L, P, allocate(5)); printInfo(L); cout<<"output should be: 8, 3, 6, 5, 4, 2,"< -* -* Type List : < First : address > -* -**/ - - - typedef int infotype; typedef struct elmlist *address; -struct elmlist{ - //------------- your code here ----------- - - - //---------------------------------------- +struct elmlist { + infotype info; + address next; }; -struct List{ - //------------- your code here ----------- - - //---------------------------------------- +struct List { + address first; }; diff --git a/obj/Debug/Main.o b/obj/Debug/Main.o new file mode 100644 index 0000000..58abb83 Binary files /dev/null and b/obj/Debug/Main.o differ diff --git a/obj/Debug/list.o b/obj/Debug/list.o index f0e2f8e..f212d7d 100644 Binary files a/obj/Debug/list.o and b/obj/Debug/list.o differ diff --git a/obj/Debug/operation.o b/obj/Debug/operation.o index b08b1f9..dd9c41d 100644 Binary files a/obj/Debug/operation.o and b/obj/Debug/operation.o differ diff --git a/operation.cpp b/operation.cpp index 0a0e067..182cb1b 100644 --- a/operation.cpp +++ b/operation.cpp @@ -13,8 +13,24 @@ void insert_sorted(List &L, infotype x) { */ //-------------your code here------------- - cout<<"your code here"< info(Q)){ + Q = next(Q); + } + if(x != info(Q)){ + if(x>info(Q)){ + insertLast(L, P); + }else if(x