Esempio n. 1
0
int main()
{
   // Define a NumberList object.
   NumberList list;

   // Build the list with some values.
   list.appendNode(2.5);
   list.appendNode(7.9);
   list.appendNode(12.6);

   // Insert a node in the middle of the list.
   list.insertNode(10.5);

   // Dispay the list
   list.displayList();
   return 0;
}
int main()
{
    const double MAX = 10.0;  // Upper limit of values

    // Create a NumberList object.
    NumberList list;

    // Add a series of numbers to the list.
    for (double x = 1.5; x < MAX; x += 1.1)
        list.appendNode(x);

    // Display the values in the list.
    cout << "Here are the values in the list:\n";
    list.displayList();

    // Display the values in reverse order.
    cout << "Here are the values in reverse order:\n";
    list.displayBackwards();
    return 0;
}