예제 #1
0
int main()
{
    IntList test;
    
    test.push_front(5);
    test.push_front(2);
    test.push_front(5);
    test.push_front(7);
    test.push_front(5);
    
    cout << "Should display counting down from five: ";
    test.display();
    
    cout << endl;
    
    test.push_back(6);
    
    cout << "Should add zero to the end: ";
    
    test.display();
    
    cout << endl;
    
    //test.insert_sorted(3);
    
    test.select_sort();
    
    cout << "Should be in order now: ";
    
    test.display();
    
    cout << endl;
    
    test.remove_duplicates();
    
    cout << "Should remove all same digits: ";
    
    test.display();
    
    cout << endl;
}
예제 #2
0
int main()
{
  IntList theList;
  IntList theOtherList;
  IntList theFinalList;
  
  theList.display();
  cout << endl;

  theList.push_front(133);
  theList.display();
  cout << endl;
  
  theList.push_front(250);
  theList.display();
  cout << endl;

  theList.push_front(550);
  theList.display();
  cout << endl;
  
  theList.pop_front();
  theList.display();
  cout << endl;
  
  theList.push_back(13);
  theList.display();
  cout << endl;
  
  theList.select_sort();
  theList.display();
  cout << endl;
  
  theList.insert_sorted(10);
  theList.display();
  cout << endl;
  
  theList.insert_sorted(225);
  theList.display();
  cout << endl;
  
  theList.pop_front();
  theList.display();
  cout << endl;
  
  theList.pop_front();
  theList.display();
  cout << endl;
  
  theList.pop_front();
  theList.display();
  cout << endl;
  
  theList.push_back(45);
  theList.display();
  cout << endl;
  
  cout << "The other list shit:\n";
  
  theOtherList.insert_sorted(225);
  theOtherList.display();
  cout << endl;
  
  theOtherList.insert_sorted(12);
  theOtherList.display();
  cout << endl;
  
  theOtherList.insert_sorted(13);
  theOtherList.display();
  cout << endl;
  
  theOtherList.insert_sorted(13);
  theOtherList.display();
  cout << endl;
  
  theOtherList.insert_sorted(12);
  theOtherList.display();
  cout << endl;
  
  theOtherList.insert_sorted(5000);
  theOtherList.display();
  cout << endl;
  
  theOtherList.remove_duplicates();
  theOtherList.display();
  cout << endl;


  cout << "The other list shit:\n";
  
  theFinalList.push_front(10);
  theFinalList.display();
  cout << endl;
  
  theFinalList.push_front(10);
  theFinalList.display();
  cout << endl;
  
  theFinalList.push_front(30);
  theFinalList.display();
  cout << endl;
  
  theFinalList.push_front(5);
  theFinalList.display();
  cout << endl;
  
  theFinalList.push_front(20);
  theFinalList.display();
  cout << endl;
  
  theFinalList.push_front(10);
  theFinalList.display();
  cout << endl;
  
  theFinalList.push_back(30);
  theFinalList.display();
  cout << endl;
  
  theFinalList.remove_duplicates();
  theFinalList.display();
  cout << endl;
  
  return 0;
}