Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "listsirkuler.h"
  3. #include "boolean.h"
  4. #include <stdlib.h>
  5.  
  6. int main (){
  7. List daftar,dafinv,dafcop,daf1,daf2;
  8. int x,nel,min,max;
  9. float avg;
  10. address temp,temp1,temp2;
  11. CreateEmpty(&daftar);
  12.  
  13. scanf("%d",&x);
  14. while (x >= 0 && x <= 100){
  15. InsVLast(&daftar,x);
  16. scanf("%d",&x);
  17. }
  18.  
  19. PrintInfo(daftar);
  20. printf("\n");
  21.  
  22. /* printf("\n");
  23. printf("\n");
  24. printf("\n");
  25. printf("\n");
  26. printf("\n");
  27. printf("\n");
  28. printf("\n");
  29. printf("\n");*/
  30.  
  31.  
  32. scanf("%d",&x);
  33. while (x != -9999){
  34. if (x == 1){
  35. scanf("%d\n",&x);
  36. InsVFirst(&daftar, x);
  37. }else if (x == 2){
  38. scanf("%d\n",&x);
  39. InsVLast(&daftar, x);
  40. }else if (x == 3){
  41. DelFirst(&daftar, &temp);
  42. printf("%d\n",Info(temp));
  43. Dealokasi(temp);
  44. }else if (x == 4){
  45. DelLast(&daftar, &temp);
  46. printf("%d\n",Info(temp));
  47. Dealokasi(temp);
  48. }else if (x == 0){
  49. PrintInfo(daftar);
  50. printf("\n");
  51. }else if (x == 5){
  52. scanf("%d",&x);
  53. DelP(&daftar, x);
  54. }else if (x == 6){
  55. scanf("%d",&x);
  56. temp = Search(daftar,x);
  57. if (temp != Nil){
  58. DelAfter(&daftar,&temp1,temp);
  59. printf("%d\n",Info(temp1));
  60. }
  61. }else if (x == 7){
  62. scanf("%d",&x);
  63. temp1 = Alokasi(x);
  64. scanf("%d",&x);
  65. temp = Search(daftar,x);
  66. if (temp != Nil){
  67. InsertAfter(&daftar,temp1,temp);
  68. }
  69. }else if(x == 8){
  70. DelVFirst(&daftar,&x);
  71. printf("%d\n",x);
  72. }else if(x == 9){
  73. DelVLast(&daftar,&x);
  74. printf("%d\n",x);
  75. }
  76.  
  77.  
  78.  
  79. scanf("%d",&x);
  80. }
  81.  
  82. PrintInfo(daftar);
  83. return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement