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


C++ BinaryTree::get方法代码示例

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


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

示例1: AddIndexOnGenre_name

void Genres::AddIndexOnGenre_name()
{
  BinaryTree<genresindex> index;
  vector<Genre*> vecp;
  _data.TreeToVectorPointers(vecp);
  for(auto i=0;i<vecp.size();++i)
  {
    genresindex indice;
    indice.key = &(vecp[i]->genre_name());
    indice.pointers.push(vecp[i]);
    try
    {
      index.push(indice);
    }
    catch (...)
    {
      index.get(indice).pointers.push(vecp[i]);
    }
  }
  index.BalanceTree();
  _indexes.push(std::move(index));
  _IndexOnGenre_name = _indexes.size() - 1;
}
开发者ID:EldarOmerefendic,项目名称:Zadaca6,代码行数:23,代码来源:genres.cpp

示例2: AddIndexOnTelephone

void Users::AddIndexOnTelephone()
{
  BinaryTree<usersindex> index;
  vector<User*> vecp;
  _data.TreeToVectorPointers(vecp);
  for(auto i=0;i<vecp.size();++i)
  {
    usersindex indice;
    indice.key = &(vecp[i]->FirstName());
    indice.pointers.push(vecp[i]);
    try
    {
      index.push(indice);
    }
    catch (...)
    {
      index.get(indice).pointers.push(vecp[i]);
    }
  }
  index.BalanceTree();
  _indexes.push(std::move(index));
  _IndexOnTelephone = _indexes.size() - 1;
}
开发者ID:EldarOmerefendic,项目名称:Zadaca6,代码行数:23,代码来源:users.cpp

示例3: AddIndexOnTitle

void Films::AddIndexOnTitle()
{
  BinaryTree<filmsindex> index;
  vector<Film*> vecp;
  _data.TreeToVectorPointers(vecp);
  for(auto i=0;i<vecp.size();++i)
  {
    filmsindex indice;
    indice.key = &(vecp[i]->title());
    indice.pointers.push(vecp[i]);
    try
    {
      index.push(indice);
    }
    catch(...)
    {
      index.get(indice).pointers.push(vecp[i]);
    }
  }
  index.BalanceTree();
  _indexes.push(std::move(index));
  _IndexOnTitle = _indexes.size() -1;
}
开发者ID:EldarOmerefendic,项目名称:Zadaca6,代码行数:23,代码来源:films.cpp

示例4: AddIndexOnBirthDate

void Actors::AddIndexOnBirthDate()
{
  BinaryTree<actorsindex> index;
  vector<Actor*> vecp;
  _data.TreeToVectorPointers(vecp);
  for(auto i=0;i<vecp.size();++i)
  {
    actorsindex indice;
    indice.key = &(vecp[i]->BirthDate());
    indice.pointers.push(vecp[i]);
    try
    {
      index.push(indice);
    }
    catch (...)
    {
      index.get(indice).pointers.push(vecp[i]);
    }
  }
  index.BalanceTree();
  _indexes.push(std::move(index));
  _IndexOnBirthDate = _indexes.size() - 1;
}
开发者ID:EldarOmerefendic,项目名称:Zadaca6,代码行数:23,代码来源:actors.cpp

示例5: main

int main(int argc, char* argv[])
{
	BinaryTree tree;
	string command;
	vector<string> commands;
	int N;
	int i = 0;
	int size;
	cout << "N = ";
	cin >> N;
	cin.ignore(numeric_limits<streamsize>::max(), '\n');
	while (i < N && i >= 0)
	{
		cout << i + 1 << ">>";
		getline(cin, command);
		commands = split(command, ' ');
		size = commands.size();
		if (size == 0)
		{
			cout << "Incorrect command. Try again.\n";
			i--;
		}
		else if (size == 2)
		{
			if (commands[0] == "add")
				tree.add(stoi(commands[1]));
			else
			{
				cout << "Incorrect command. Try again.\n";
				i--;
			}
		}
		else if (size == 1)
		{
			try
			{
				if (commands[0] == "del")
					tree.del();
				else if (commands[0] == "get")
					cout << tree.get() << endl;
				else if (commands[0] == "show")
				{
					tree.show();
					cout << endl;
				}
				else
				{
					cout << "Incorrect command. Try again.\n";
					i--;
				}
			}
			catch (char* message)
			{
				cout << message << endl;
			}
		}
		else
		{
			cout << "Incorrect command. Try again.\n";
			i--;
		}
		i++;
	}
	system("pause");
	return 0;
}
开发者ID:lisa-bella97,项目名称:PriorityBinaryTree,代码行数:66,代码来源:Main.cpp


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