本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例6: deleteCDs
void deleteCDs(ListArray<CD>* list)
{
ListArrayIterator<CD>* iter = list->iterator();
while(iter->hasNext())
{
CD* cd = iter->next();
delete cd;
}
delete iter;
}
示例7: while
Permutation::~Permutation()
{
ListArrayIterator<Integer>* iter = numbers->iterator();
while(iter->hasNext())
{
Integer* i = iter->next();
delete i;
}
delete iter;
delete numbers;
}
示例8: displayViableWords
void Password::displayViableWords()
{
ListArrayIterator<String>* iter = viable_words->iterator();
while(iter->hasNext())
{
String* w = iter->next();
w->displayString();
cout << "/n";
}
delete iter;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}