Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1301160471-1301163598 #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Multi_III/Multi_III.depend
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,39 @@
"list_parent.h"
<iostream>

1524922551 source:c:\users\c3x\documents\github\asd_multilist\multi_iii\list_child.cpp
"list_child.h"

1524919451 c:\users\c3x\documents\github\asd_multilist\multi_iii\list_child.h
<conio.h>
<stdio.h>
<iostream>
<windows.h>

1524919962 source:c:\users\c3x\documents\github\asd_multilist\multi_iii\list_parent.cpp
"list_parent.h"

1524912378 c:\users\c3x\documents\github\asd_multilist\multi_iii\list_parent.h
<conio.h>
<stdio.h>
<iostream>
<windows.h>

1524925417 source:c:\users\c3x\documents\github\asd_multilist\multi_iii\list_relasi.cpp
"list_relasi.h"

1524924073 c:\users\c3x\documents\github\asd_multilist\multi_iii\list_relasi.h
"list_relasi.h"
"list_child.h"
"list_parent.h"
<conio.h>
<stdio.h>
<iostream>
<windows.h>

1524925417 source:c:\users\c3x\documents\github\asd_multilist\multi_iii\main.cpp
<iostream>
"list_child.h"
"list_parent.h"
"list_relasi.h"

28 changes: 14 additions & 14 deletions Multi_III/Multi_III.layout
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="list_child.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="main.cpp" open="1" top="1" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="22" />
<Cursor1 position="3119" topLine="0" />
</Cursor>
</File>
<File name="list_parent.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="list_child.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1034" topLine="11" />
<Cursor1 position="357" topLine="24" />
</Cursor>
</File>
<File name="list_relasi.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="list_parent.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="26" topLine="0" />
<Cursor1 position="2758" topLine="113" />
</Cursor>
</File>
<File name="list_relasi.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="list_parent.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1140" topLine="15" />
<Cursor1 position="330" topLine="10" />
</Cursor>
</File>
<File name="list_parent.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="list_child.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1142" topLine="41" />
<Cursor1 position="3128" topLine="119" />
</Cursor>
</File>
<File name="main.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="list_relasi.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1152" topLine="42" />
<Cursor1 position="2827" topLine="105" />
</Cursor>
</File>
<File name="list_child.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="list_relasi.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1072" topLine="15" />
<Cursor1 position="1261" topLine="21" />
</Cursor>
</File>
</CodeBlocks_layout_file>
Binary file modified Multi_III/bin/Debug/Multi_III.exe
Binary file not shown.
143 changes: 119 additions & 24 deletions Multi_III/list_child.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,135 @@ address_child alokasi(infotype_child x) {
return P;
}

void dealokasi(address_child &P) {
/**
* FS : delete element pointed by P
*/
delete(P);
}

void insertFirst(List_child &L, address_child P) {
if(first(L) == NULL) {
last(L) = P;
first(L) = P;
} else {
next(P) = first(L);
prev(first(L)) = P;
first(L) = P;
if(first(L)==NULL){
first(L)=P;
last(L)=P;
next(last(L))=first(L);
prev(first(L))=last(L);
}else{
next(P)=first(L);
first(L)=P;
next(last(L))=first(L);
prev(first(L))=last(L);
}
}

void printInfo(List_child L) {
address_child P = first(L);
while(P !=NULL) {
cout<<"->"<<info(P)<<endl;
P = next(P);
void insertLast(List_child &L, address_child P){
if(first(L)==NULL){
first(L)=P;
last(L)=P;
next(last(L))=first(L);
prev(first(L))=last(L);
}else{
next(last(L))=P;
next(P)=first(L);
prev(P)=last(L);
prev(first(L))=P;
last(L)=P;
}
}

void insertAfter(List_child &L, address_child &Prec, address_child P){
if(first(L)!=NULL){
if(Prec!=NULL){
if(Prec==last(L)){
insertLast(L,P);
}else{
next(P)=next(Prec);
prev(next(P))=P;
next(Prec)=P;
prev(P)=Prec;
}
}
}
}

address_child findElm(List_child L, infotype_child x) {
address_child P = first(L);
while(P != NULL) {
if(info(P)==x) {
return P;
void deleteFirst(List_child &L, address_child &P){
if(first(L)!=NULL){
if(next(first(L))==first(L)){
P = first(L);
first(L)=NULL;
last(L)=NULL;
}else{
P = first(L);
prev(next(P))=last(L);
next(last(L))=next(P);
first(L)=next(P);
next(P)=NULL;
prev(P)=NULL;
}
P = next(P);
}
return NULL;
}

void insertAfter(address_child &Prec, address_child P) {
prev(next(Prec)) = P;
next(P) = next(Prec);
prev(P) = Prec;
next(Prec) = P;
void deleteLast(List_child &L, address_child &P){
if(first(L)!=NULL){
if(next(first(L))==first(L)){
deleteFirst(L,P);
}else{
P = last(L);
prev(first(L))=prev(P);
next(prev(P))=first(L);
prev(P)=NULL;
next(P)=NULL;

}
}
}
void deleteAfter(List_child &L, address_child Prec, address_child &P){
if(first(L)!=NULL){
if(Prec!=NULL){
if(Prec==last(L)){
deleteFirst(L,P);
}else if(next(Prec)==last(L)){
deleteLast(L,P);
}else{
P=next(Prec);
next(Prec)=next(P);
prev(next(P))=Prec;
next(P)=NULL;
prev(P)=NULL;
}
}
}else{}
}

void printInfo(List_child L) {
address_child P = first(L);
do{
cout<<"Customer ID : "<<P->info.id<<endl;
cout<<"Customer Name : "<<P->info.name<<endl;
P = next(P);
cout<<endl;
}while(P != first(L));
}



address_child findElm(List_child L, infotype_child x) {
address_child P;
P = first(L);
if(first(L)!=NULL){
do{
if(P->info.id == x.id){
return P;
}else{
P = next(P);
}
}while(next(P)!=first(L) && P->info.id != x.id);

}else{
return NULL;
}
if(P->info.id!=x.id){
return NULL;
}
return P;
}
13 changes: 10 additions & 3 deletions Multi_III/list_child.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#ifndef LIST_CHILD_H_INCLUDED
#define LIST_CHILD_H_INCLUDED


#include <iostream>
#include<conio.h>
#include<stdio.h>
#include<iostream>
#include<windows.h>
using namespace std;

#define next(P) P->next
Expand All @@ -11,7 +13,12 @@ using namespace std;
#define last(L) L.last
#define info(P) P->info

typedef string infotype_child;
struct memb{
int id;
string name;
};

typedef memb infotype_child;
typedef struct elmlist_child *address_child;

struct elmlist_child{
Expand Down
Loading