当前位置: 首页>>代码示例>>C++>>正文


C++ ListArrayIterator类代码示例

本文整理汇总了C++中ListArrayIterator的典型用法代码示例。如果您正苦于以下问题:C++ ListArrayIterator类的具体用法?C++ ListArrayIterator怎么用?C++ ListArrayIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ListArrayIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: words

void Password::guess(int try_password, int num_matches) //index of guessed word in the list of all words (1-based), number of matches reported by fallout 3, update viable passwords list
{
	String* temp = all_words->get(try_password); //gets word guessed

	ListArray<String>* temp_array = new ListArray<String>();

	ListArrayIterator<String>* iter = viable_words->iterator();
    
	String* yak = all_words->get(try_password);
	while(iter->hasNext())
	{
		String* blah = iter->next();
		
		int matches = getNumMatches(blah, yak);
        	//call getNumMatches

		if(num_matches == matches)
		{
			temp_array->add(blah);	
		}
	}
        delete viable_words;
	viable_words = temp_array; 
	
}
开发者ID:MarshallHunt,项目名称:Lab03,代码行数:25,代码来源:Password.cpp

示例2: main

int main()
{
   ListArray<CD>* cds = CD::readCDs("cds.txt");
   int num_items = cds->size();
   cout << num_items << endl;

while(true)
{
   HeapSkew<CD>* sh = new HeapSkew<CD>(&CD::compare_items);

   ListArrayIterator<CD>* iter = cds->iterator();
   while(iter->hasNext())
   {
      CD* cd = iter->next();
      sh->heapInsert(cd);
   }
   delete iter;

   /*while(!(sh->heapIsEmpty()))
   {
      CD* cd = sh->heapRemove();
      cd->displayCD();
   }*/

   delete sh;
}
   deleteCDs(cds);
   delete cds;

   return 0;
}
开发者ID:kabrown44,项目名称:Lab13,代码行数:31,代码来源:HeapDriver.cpp

示例3: main

int main()
{
   ListArray<CD>* cds = CD::readCDs("cds.txt");
   int num_items = cds->size();
   cout << num_items << endl;

   TableSortedList<CD>* slt = new TableSortedList<CD>(&CD::compare_items, &CD::compare_keys);

   //DO THIS
   //thoroughly test your table

   ListArrayIterator<CD>* iter = cds->iterator();
   
   
	if(slt->tableIsEmpty())
	{
		int count = 0;
		while(iter->hasNext())
		{
		CD* cd = iter->next();
		slt->tableInsert(cd);
		count++;
		}
	}

	ListDoublyLinkedIterator<CD>* iter2 = slt->iterator();
	
	/*while(iter2->hasNext())
	{
		CD* myCD = iter2->next();
		myCD->getKey()->displayString();
		cout << endl;
		
	}*/

	String* title = new String("Manifesto");
	
	
	bool rem = slt->tableRemove(title);
	if (rem)
		cout << "Removed item" << endl << endl;
	
	while(iter2->hasNext())
	{
		CD* myCD = iter2->next();
		myCD->getKey()->displayString();
		cout << endl;
	}
	
	cout << endl;
	cout << slt->tableSize() << endl;
	
	delete title;
   deleteCDs(cds);
   delete cds;
   delete slt;
   return 0;
}
开发者ID:luigi2004,项目名称:Lab-14,代码行数:58,代码来源:TableDriver.cpp

示例4: displayViableWords

void Password::displayViableWords() //display the current list of possible passwords
{
	ListArrayIterator<String>* display = viable_words->iterator();
	while(display->hasNext())
	{
		String* aha = display->next();
		aha->displayString();
		cout << endl;
	}
}
开发者ID:MarshallHunt,项目名称:Lab03,代码行数:10,代码来源:Password.cpp

示例5:

Password::~Password() //(there is work to do here, delete the individual words)
{
	ListArrayIterator<String>* iter = all_words->iterator();
	while(iter->hasNext())
	{
		String* temp = iter->next();
		delete temp;
	}
	delete all_words;
	delete viable_words;
}
开发者ID:MarshallHunt,项目名称:Lab03,代码行数:11,代码来源:Password.cpp

示例6: deleteCDs

void deleteCDs(ListArray<CD>* list)
{
   ListArrayIterator<CD>* iter = list->iterator();

   while(iter->hasNext())
   {
      CD* cd = iter->next();
      delete cd;
   }
   delete iter;
}
开发者ID:Gageness,项目名称:CSC2110-Lab14,代码行数:11,代码来源:TableDriver.cpp

示例7: while

Permutation::~Permutation()
{
   ListArrayIterator<Integer>* iter = numbers->iterator();
   while(iter->hasNext())
   {
      Integer* i = iter->next();
      delete i;
   }
   delete iter;
   delete numbers;
}
开发者ID:castringer42,项目名称:Lab3,代码行数:11,代码来源:Permutation.cpp

示例8: displayViableWords

void Password::displayViableWords()
{
	ListArrayIterator<String>* iter = viable_words->iterator();
	while(iter->hasNext())
	{
		String* w = iter->next();
		w->displayString();
		cout << "/n";
	}
	delete iter;
}
开发者ID:AtlantisCoder,项目名称:lab3,代码行数:11,代码来源:Password.cpp

示例9: addCDs

void addCDs(ListArray<CD>* list, Hybrid<CD>* h)
{
   ListArrayIterator<CD>* iter = list->iterator();

   while(iter->hasNext())
   {
      CD* cd = iter->next();
      h->enqueue(cd);
   }

   delete iter;
}
开发者ID:bggarland42,项目名称:DSLAB10,代码行数:12,代码来源:HybridDriver.cpp

示例10:

Password::~Password()
{
	ListArrayIterator<String>* iter = all_words->iterator();
	while(iter->hasNext())
	{
		String* Dword= iter->next();
		delete Dword;
	}
	delete iter;
	delete viable_words;
	delete all_words;
}
开发者ID:AtlantisCoder,项目名称:lab3,代码行数:12,代码来源:Password.cpp

示例11: keyReleased

//callback
bool InputManager::keyReleased(const OIS::KeyEvent& e)
{
//cout << "KR" << endl;
   //notify each of the listeners
   ListArrayIterator<InputListener>* iter = input_listeners->iterator();
   while(iter->hasNext())
   {
      InputListener* listener = iter->next();
      listener->keyReleased(keyMap(e));
   }
   delete iter;

   return true;
}
开发者ID:JeeseJames,项目名称:GameEngineCrash,代码行数:15,代码来源:InputManager.cpp

示例12: guess

void Password::guess(int try_password, int num_matches)
{
	String* guessed_word = all_words->get(try_password);
	ListArray<String>* new_list = new ListArray<String>();
	ListArrayIterator<String>* itr = viable_words->iterator();
	while(itr->hasNext())
	{
		String* comp_word = itr->next();
		int matched = getNumMatches(guessed_word,comp_word);
		
		if(matched == num_matches)
			new_list->add(comp_word);	
	}
	delete viable_words;
	viable_words = new_list;
}
开发者ID:lovelykiss,项目名称:Lab03,代码行数:16,代码来源:Password.cpp

示例13: mouseMoved

//callback
bool InputManager::mouseMoved(const OIS::MouseEvent& e)
{
//cout << "MM" << endl;
   //notify each of the listeners
   ListArrayIterator<InputListener>* iter = input_listeners->iterator();
   while(iter->hasNext())
   {
      InputListener* listener = iter->next();
      int x_loc = (int) e.state.X.abs * (window_width / 50.0);
      int y_loc = (int) e.state.Y.abs * (window_height / 50.0);
      float x_rel = e.state.X.rel;
      float y_rel = e.state.Y.rel;
      listener->mouseMoved(x_loc, y_loc, x_rel, y_rel);  //current location of the mouse (absolute coords and relative coords)
   }
   delete iter;

   return true;
}
开发者ID:JeeseJames,项目名称:GameEngineCrash,代码行数:19,代码来源:InputManager.cpp

示例14: mouseReleased

//callback
bool InputManager::mouseReleased(const OIS::MouseEvent& e, OIS::MouseButtonID id)
{
//cout << "MR" << endl;
   //notify each of the listeners
   ListArrayIterator<InputListener>* iter = input_listeners->iterator();
   while(iter->hasNext())
   {
      InputListener* listener = iter->next();

      std::string game_mouse = mouseMap(id);
      int x_loc = (int) e.state.X.abs * (window_width / 50.0);
      int y_loc = (int) e.state.Y.abs * (window_height / 50.0);
      listener->mouseReleased(x_loc, y_loc, game_mouse);  //absolute location of mouse when released and which button was released
   }
   delete iter;

   return true;
}
开发者ID:JeeseJames,项目名称:GameEngineCrash,代码行数:19,代码来源:InputManager.cpp

示例15: main

int main()
{
   //the unsorted ListArray of cds
   ListArray<CD>* cds = CD::readCDs("cds.txt");
   int num_items = cds->size();
   cout << num_items << endl;
   cout << endl;

   //test the binary search tree
   //insert all of the cds
   ListArrayIterator<CD>* iter = cds->iterator();
   BinarySearchTree<CD>* bst = new BinarySearchTree<CD>(&CD::compare_items, &CD::compare_keys);
   while(iter->hasNext())
   {
      CD* cd = iter->next();
      bst->insert(cd);
   }
   delete iter;

   
   //DO THIS
   //test your tree sort method
   CD** unsorted_cds = cds->toArray();
   CD** sorted_cds = BinarySearchTree<CD>::treeSort(unsorted_cds, num_items, &CD::compare_items, &CD::compare_keys);

   for (int i = 0; i < num_items; i++)
   {
	   sorted_cds[i]->getKey()->displayString();
	   cout << endl;
   }










   deleteCDs(cds);
   delete cds;
   return 0;
}
开发者ID:hannahhoffman,项目名称:Lab11,代码行数:44,代码来源:BSTDriver.cpp


注:本文中的ListArrayIterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。