二叉树交换我需要交换左右节点 [英] binary tree swap I need to swap left and right nodes

查看:106
本文介绍了二叉树交换我需要交换左右节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个函数swapSubTrees,该函数交换二叉树的所有左右子树.将此函数添加到类binaryTreeType并创建一个程序来测试此函数.我不断收到以下错误,并且不确定是否有人在此方面做错了,我真的很感激.

I need to write a function, swapSubTrees, that swaps all of the left and right subtrees of a binary tree. Add this function to the class binaryTreeType and create a program to test this function. i keep getting the following errors and not sure what I am doing wrong here if someone could help I would really appreciate.

++.exe "F:\Programming II class Winter Qtr\unit 10\main1.cpp" -o "F:\Programming II class Winter Qtr\unit 10\main1.exe"    -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include"  -I"C:\Dev-Cpp\include\c++\3.4.2\backward"  -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32"  -I"C:\Dev-Cpp\include\c++\3.4.2"  -I"C:\Dev-Cpp\include"   -L"C:\Dev-Cpp\lib"
F:\Programming II class Winter Qtr\unit 10\main1.cpp: In function `int main(int, char**)':
F:\Programming II class Winter Qtr\unit 10\main1.cpp:17: error: `insert' has not been declared
F:\Programming II class Winter Qtr\unit 10\main1.cpp:17: error: request for member of non-aggregate type before '(' token
F:\Programming II class Winter Qtr\unit 10\main1.cpp:22: error: `insert' has not been declared
F:\Programming II class Winter Qtr\unit 10\main1.cpp:22: error: request for member of non-aggregate type before '(' token
F:\Programming II class Winter Qtr\unit 10\main1.cpp:27: error: `print' has not been declared
F:\Programming II class Winter Qtr\unit 10\main1.cpp:27: error: request for member of non-aggregate type before '(' token
F:\Programming II class Winter Qtr\unit 10\main1.cpp:31: error: `printTree' has not been declared
F:\Programming II class Winter Qtr\unit 10\main1.cpp:31: error: request for member of non-aggregate type before '(' token
Execution terminated

推荐答案

嗯,错误是不言自明的.仔细看看,您会看到

F:\Programming II class Winter Qtr\unit 10\main1.cpp:17: error: `insert'' has not been declared

它告诉您有关insert的信息吗?你看到了吗?您需要先定义它,然后才能使用它.可能您错过了包含文件或路径吗?
Well, the error is self explanatory. Take a closer look and you will see

F:\Programming II class Winter Qtr\unit 10\main1.cpp:17: error: `insert'' has not been declared

It is telling you something about insert? Can you see that. You need to define it before you can use it. May be you missed an include file or a path?


这篇关于二叉树交换我需要交换左右节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆