Advertisement
ChaeYuriya

main.cpp

Nov 2nd, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.40 KB | None | 0 0
  1. #include <iostream>
  2. #include "DLL.cpp"
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.     List data,data2,data3,datasong;
  8.     createList(data);
  9.     createList(data2);
  10.     createList(datasong);
  11.  
  12.     address num1 = new elmList;
  13.     address num2 = new elmList;
  14.     address num3 = new elmList;
  15.     address num4 = new elmList;
  16.     address num5 = new elmList;
  17.     address num6 = new elmList;
  18.  
  19.     createNewElement(1,num1);
  20.     createNewElement(2,num2);
  21.     createNewElement(3,num3);
  22.     createNewElement(4,num4);
  23.     createNewElement(5,num5);
  24.     createNewElement(6,num6);
  25.     //data 1
  26.  
  27.     cout<<"Insert First"<<endl;
  28.     insertFirst(data,num1);
  29.     printInfo(data);
  30.  
  31.     cout<<"Insert Last"<<endl;
  32.     insertLast(data,num2);
  33.     printInfo(data);
  34.  
  35.     cout<<"Insert Last"<<endl;
  36.     insertLast(data,num4);
  37.     printInfo(data);
  38.  
  39.     cout<<"Insert After 2"<<endl;
  40.     inserAfter(data,num2,num3);
  41.     printInfo(data);
  42.  
  43.     //data2
  44.     insertLast(data2,num5);
  45.     insertLast(data2,num6);
  46.  
  47.     address del1 = new elmList;
  48.     deleteFirst(data,del1);
  49.     cout<<"Data yang didelete : " << info(del1) << endl;
  50.     printInfo(data);
  51.  
  52.     address del3 = new elmList;
  53.     deleteAfter(data,num2,del3);
  54.     cout<<"Data yang didelete : " << info(del3) << endl;
  55.     printInfo(data);
  56.  
  57.     address del4 = new elmList;
  58.     deleteLast(data,del4);
  59.     cout<<"Data yang didelete : " << info(del4) << endl;
  60.     printInfo(data);
  61.  
  62.     cout<<"Data 1"<<endl;
  63.     printInfo(data);
  64.  
  65.     cout<<"Data 2"<<endl;
  66.     printInfo(data2);
  67.     concat(data,data2,data3);
  68.  
  69.     cout<<"Concat"<<endl;
  70.     printInfo(data3);
  71.  
  72.     address song1 = new elmList;
  73.     address song2 = new elmList;
  74.     address song3 = new elmList;
  75.     address song4 = new elmList;
  76.  
  77.     createNewSong(1,"hold me",song1);
  78.     createNewSong(2,"press me",song2);
  79.     createNewSong(3,"kill me",song3);
  80.     createNewSong(4,"stress me",song4);
  81.  
  82.     insertLast(datasong,song1);
  83.     insertLast(datasong,song2);
  84.     insertLast(datasong,song3);
  85.     insertLast(datasong,song4);
  86.  
  87.     cout<<"Data lagu"<<endl;
  88.     printInfo(datasong);
  89.  
  90.     cout<<"Mencari lagu press me"<<endl;
  91.     address cari = getSongAddress("press me",datasong);
  92.     cout<<"Id yang didapat : "<< info(cari) <<endl<<endl;
  93.  
  94.     cout<<"Delete lagu kill me"<<endl;
  95.     removeLagu("kill me",datasong);
  96.  
  97.     cout<<"Hasil setelahnya lagu"<<endl;
  98.     printInfo(datasong);
  99.     return 0;
  100. }
  101.  
  102.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement