⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stdafx.cpp

📁 是编译器我花了好几个礼拜才编好的确实难的这是个不错的编译器
💻 CPP
字号:
// stdafx.cpp : source file that includes just the standard includes
//	二叉树的显示输出.pch will be the pre-compiled header
//	stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"
#include "BinTree3P.h"




/****************************************************************
用字符串初始化数 按先序顺序输入 "空"用 
****************************************************************/

void CreatTree(CBinTree3P<char> & tree, char * data , int len)
{
	 stack<CBinTreNode<char> *> skPos;				//保存应插入的地址
	 stack<bool> skIsRig;					//判断插入位置是否在右侧 

	 tree.CreatRoot(data[0]);
	 CBinTreNode<char> * pPos = tree.m_pRoot;
	 skPos.push(pPos);
	 skIsRig.push(false);
 	 
	 for(int i = 1;i<len && !skPos.empty();i++){
	 	if(data[i] == '#'){
			 if(skIsRig.top() == false){
          		  		skIsRig.pop();
          		  		skIsRig.push(true);
          		  		continue;
	            }
	         else{
          		  		skPos.pop();
          		  		skIsRig.pop();
          		  		continue;
	            }
	 	}
	     else{
	          if(skIsRig.top() == false){
	      		  		 pPos = tree.InsertLefC(skPos.top(),data[i]);
	      		  		 skIsRig.pop();
	      		  		 skIsRig.push(true);
	      		  		 skPos.push(pPos);
	      		  		 skIsRig.push(false);
	      		  		continue;
	           }
	           else{
	                     pPos = tree.InsertRigC(skPos.top(),data[i]);
	                     skIsRig.pop();
	                     skPos.pop();
	                     skPos.push(pPos);
	                     skIsRig.push(false);
	      		  		continue;
	           }
	    }
	}
	if(!skPos.empty() || i< len ) AfxMessageBox("!!!创建二叉树指令字符串错误",30);

}

⌨️ 快捷键说明

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