# Include "stdafx. h "# include <iostream >#include <vector> using namespace std; struct BinaryTreeNode {int m_nValue; BinaryTreeNode * m_pLeft; BinaryTreeNode * m_pRight;}; void FindPath (BinaryTreeNode * pRoot, int nSum, vector <int> & path) {if (pRoot = NULL | nSum = 0) {return ;} if (pRoot-> m_nValue = nSum & pRoot-> m_pLeft = NULL & pRoot-> m_pRight = NULL) {vector <int >:: iterator iter = path. begin (); for (; I Ter! = Path. end (); iter ++) {cout <* iter <"" ;}cout <pRoot-> m_nValue <endl; return;} path. push_back (pRoot-> m_nValue); if (pRoot-> m_pLeft! = NULL) {FindPath (pRoot-> m_pLeft, nSum-pRoot-> m_nValue, path);} if (pRoot-> m_pRight! = NULL) {FindPath (pRoot-> m_pRight, nSum-pRoot-> m_nValue, path);} path. pop_back () ;}// construct a binary tree in the First Order. Input # indicates that the node is empty void CreateBinaryTree (BinaryTreeNode * & pRoot) {int nNodeValue = 0; cin> nNodeValue; if (-1 = nNodeValue) {pRoot = NULL; return;} else {pRoot = new BinaryTreeNode (); pRoot-> m_nValue = nNodeValue; CreateBinaryTree (pRoot-> m_pLeft ); createBinaryTree (pRoot-> m_pRight) ;}} void PrintInOrder (BinaryTreeNode * & pRoo T) {if (pRoot! = NULL) {PrintInOrder (pRoot-> m_pLeft); cout <pRoot-> m_nValue <""; PrintInOrder (pRoot-> m_pRight );}} int _ tmain (int argc, _ TCHAR * argv []) {BinaryTreeNode * pRoot = NULL; CreateBinaryTree (pRoot); PrintInOrder (pRoot); cout <endl; vector <int> path; FindPath (pRoot, 22, path); system ("pause"); return 0 ;}