Singly Linked List Library Program
With Bin Sort
#include "linklist.h"
Library High("/home/leap/cs221/book.dat");
char command;
int startpos,endpos;
main()
{
while (1)
{
cout << "Enter a command: ";
cin >> command;
while (cin.get()!='\n');
switch (command){
case 'x': case 'q': exit(0);
case 'n':
case '+':
High.ToNext();
High.Print();
break;
case 'p': case '-':
High.ToPrev();
High.Print();
break;
case 'e':
High.ToLast();
High.Print();
break;
case 'b':
High.ToFirst();
High.Print();
break;
case 'i':
cout << "Enter book information\n";
char BookInfo[500];
cin.getline(BookInfo,499,'\n');
High.Insert(BookInfo);
break;
case 's':
cout << "Bin Sort Function\n Enter starting and ending sort positions: ";
cin >> startpos >> endpos;
High.BinSort(startpos,endpos);
break;
}
}
}