Example #1
0
int main()
{
    IntList list;

    while(true)
    {
        string cmd;
        cin >> cmd;
        if(cmd == "append")
        {
            int elem;
            cin >> elem;
            list.append(elem);
        }
        if(cmd == "remove")
        {
            int index;
            cin >> index;
            list.remove(index);
        }
Example #2
0
//provides the index of the highest triangle of a set
//criterion are the normalised 2D-euclidean coordinates
int getHighest(trivec &triangles, ivec &index, IntList &list, bool sorted)
{
    /* 
      int i = 0;
      int ind = 0;

      for(i = 0 ; i < index.size(); i++)
      {
         ind = index[i];
         if( sorted == true )
         {
            if( (triangles[ind]).getPacked() == true )
            {
   continue;
   }
   else
   {
   break;
   }
   }
   else
   {
   cout << "\n... i don't like to run after special\n\ 
   elements in non-sorted lists ...\n" << flush;
   }
   }
   */
    int j = list.getStart();
    int el = list.getElement(j);
    //cout << "\nlist index  : " << flush << j << flush;
    //cout << "\nlist element: " << flush << el << flush;
    //cout << '\n' << flush;
    list.remove(j);

    return el;
}