Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "sortedtype.h"
- using namespace std;
- void printList (SortedType<int>* list) {
- int item;
- for (int i = 0; i < list->LengthIs(); i++) {
- list->GetNextItem(item);
- cout << item << " ";
- }
- list->ResetList();
- cout << endl;
- }
- int main () {
- SortedType<int> list;
- cout << list.LengthIs() << endl;
- int input;
- for (int i = 0; i < 5; i++) {
- cin >> input;
- list.InsertItem(input);
- }
- printList(&list);
- int item;
- bool found;
- list.RetrieveItem(item = 6, found);
- if (found)
- cout << "Item is found" << endl;
- else
- cout << "Item is not found" << endl;
- list.RetrieveItem(item = 5, found);
- if (found)
- cout << "Item is found" << endl;
- else
- cout << "Item is not found" << endl;
- if (list.IsFull())
- cout << "List is full" << endl;
- else
- cout << "List is not full" << endl;
- list.DeleteItem(1);
- printList(&list);
- if (list.IsFull())
- cout << "List is full" << endl;
- else
- cout << "List is not full" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement