Advertisement
ChaeYuriya

Assignment 9 : main.cpp

Nov 23rd, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #include <iostream>
  2. #include "DLL.cpp"
  3.  
  4. void InsertLoop(List &Data){
  5.     string name;
  6.     float rate;
  7.     for(int x=0;x<4;x++){
  8.         cout <<"Input Name : ";
  9.         cin >> name;
  10.         cout <<"Rate : ";
  11.         cin >> rate;
  12.         address data1 = createNewElement(name,rate);
  13.         InsertFirst(Data,data1);
  14.     }
  15. }
  16.  
  17. int main(){
  18.     List Data,upper,under;
  19.     CreateList(Data);
  20.     CreateList(upper);
  21.     CreateList(under);
  22.  
  23.     InsertLoop(Data);
  24.  
  25.     ShowList(Data);
  26.  
  27.     address data2;
  28.     DeleteFirst(Data,data2);
  29.     cout << "================================" << endl;
  30.     cout << "Data yang dihapus : "<< endl;
  31.     cout << "Name : "<< info(data2).name << endl;
  32.     cout << "Rate : " << info(data2).rating << endl;
  33.     cout << "================================" << endl;
  34.  
  35.     Reset(Data);
  36.  
  37.     InsertLoop(Data);
  38.     ShowList(Data);
  39.  
  40.     float inputRating;
  41.     cout <<"Input Rating for split Data : ";
  42.     cin >> inputRating;
  43.  
  44.     SplitData(inputRating,Data,under,upper);
  45.  
  46.     cout <<"Data upper rating :  " <<endl;
  47.     ShowList(upper);
  48.     cout <<"Data Under rating :  " <<endl;
  49.     ShowList(under);
  50. }
  51.  
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement