示例#1
0
文件: Pr19-7.cpp 项目: Hongclass/C-
int main()
{
   const int MAX = 10;  // Maximum number of values

   // Define a NumberList object.
   NumberList list;

   // Build the list with a series of numbers.
   for (int x = 0; x < MAX; x++)
      list.insertNode(x);

   // Display the number of nodes in the list.
   cout << "The number of nodes is "
        << list.numNodes() << endl;
   return 0;
}
示例#2
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;
}