更新时间:2018-11-22 16:18作者:李一老师
#include
#include
#include
#include
#define SOURCE_FILE "text.in"
#define OUTPUT_FILE "word.out"
#define MAX_WORD_LEN 128
typedef struct treenode
{
char szWord[MAX_WORD_LEN];
int nCount;
struct treenode* pLeft;
struct treenode* pRight;
}BNODE;
int getword(FILE* pFile,char* pasWordBuffer,int nBufferLen);
void binary_tree(BNODE** ppNode,char* pszWord)
{
if(ppNode != NULL && pszWord != NULL)
{
BNODE* pCurrentNode = NULL;
BNODE* pMemoNode = NULL;
int nStrCmpRes=0;
____(1)_____;pCurrentNode=*ppNode
while(pCurrentNode)
{
/*寻找插入位置*/
nStrCmpRes = strcmp(pszWord, ___(2)___ );pCurrentNode-
>nCount
if(!nStrCmpRes)
{
___(3)___; pCurrentNode->nCount++
return;
}
else
{