videobinarytreeimp.cpp

来自「data+structures+using+c的源码」· C++ 代码 · 共 93 行

CPP
93
字号
#include <iostream>
#include <string>
#include "videoBinaryTree.h"

using namespace std;

bool videoBinaryTree::isVideoAvailable(string title) 
{
	cout<<"See Programming Exercise 10."<<endl;

	return false;
}

void videoBinaryTree::videoCheckIn(string title)
{
	cout<<"See Programming Exercise 10."<<endl;
}

void videoBinaryTree::videoCheckOut(string title)
{
	cout<<"See Programming Exercise 10."<<endl;
}

bool videoBinaryTree::videoCheckTitle(string title)
{
	cout<<"See Programming Exercise 10."<<endl;

	return false;
}

void videoBinaryTree::videoUpdateInStock(string title, int num)
{
	cout<<"See Programming Exercise 10."<<endl;
}

void videoBinaryTree::videoSetCopiesInStock(string title, 
											int num)
{
	cout<<"See Programming Exercise 10."<<endl;
}

bool videoBinaryTree::videoSearch(string title)
{
	cout<<"See Programming Exercise 10."<<endl;

	return false;
}

void videoBinaryTree::searchVideoList(string title, 
									  bool& found,
									  nodeType<videoType>* &current)
{
	found = false;   
   
	videoType temp;

	temp.setVideoInfo(title,"","","","","",0);

	if(root == NULL)  //the tree is empty
		cout<<"Cannot search an empty list. "<<endl;
	else
	{
		current = root;   //set current point to the root node 
		                  //of the binary tree
		found = false;    //set found to false

		while(!found && current != NULL) //search the tree
			if(current->info == temp)    //theitem is found
       			found = true;
			else
				if(current->info > temp)
					current = current->llink;
				else
					current = current->rlink;
	} //end else
}

void videoBinaryTree::videoPrintTitle()
{
	inorderTitle(root);
}

void videoBinaryTree::inorderTitle(nodeType<videoType> *p)
{
	if(p != NULL)
	{
		inorderTitle(p->llink);
		p->info.printTitle();
		inorderTitle(p->rlink);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?