Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "listsirkuler.h"
- #include "boolean.h"
- #include <stdlib.h>
- int main (){
- List daftar,dafinv,dafcop,daf1,daf2;
- int x,nel,min,max;
- float avg;
- address temp,temp1,temp2;
- CreateEmpty(&daftar);
- scanf("%d",&x);
- while (x >= 0 && x <= 100){
- InsVLast(&daftar,x);
- scanf("%d",&x);
- }
- PrintInfo(daftar);
- printf("\n");
- /* printf("\n");
- printf("\n");
- printf("\n");
- printf("\n");
- printf("\n");
- printf("\n");
- printf("\n");
- printf("\n");*/
- scanf("%d",&x);
- while (x != -9999){
- if (x == 1){
- scanf("%d\n",&x);
- InsVFirst(&daftar, x);
- }else if (x == 2){
- scanf("%d\n",&x);
- InsVLast(&daftar, x);
- }else if (x == 3){
- DelFirst(&daftar, &temp);
- printf("%d\n",Info(temp));
- Dealokasi(temp);
- }else if (x == 4){
- DelLast(&daftar, &temp);
- printf("%d\n",Info(temp));
- Dealokasi(temp);
- }else if (x == 0){
- PrintInfo(daftar);
- printf("\n");
- }else if (x == 5){
- scanf("%d",&x);
- DelP(&daftar, x);
- }else if (x == 6){
- scanf("%d",&x);
- temp = Search(daftar,x);
- if (temp != Nil){
- DelAfter(&daftar,&temp1,temp);
- printf("%d\n",Info(temp1));
- }
- }else if (x == 7){
- scanf("%d",&x);
- temp1 = Alokasi(x);
- scanf("%d",&x);
- temp = Search(daftar,x);
- if (temp != Nil){
- InsertAfter(&daftar,temp1,temp);
- }
- }else if(x == 8){
- DelVFirst(&daftar,&x);
- printf("%d\n",x);
- }else if(x == 9){
- DelVLast(&daftar,&x);
- printf("%d\n",x);
- }
- scanf("%d",&x);
- }
- PrintInfo(daftar);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement