免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2185 | 回复: 2
打印 上一主题 下一主题

vc不能包含多个系统头文件的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-04-23 23:20 |只看该作者 |倒序浏览
#include <stack>
#include <iostream>
//#include"struct.h"
#include"bintree.h"

void BTree:reorder(BTreeNode * t)
        {
        if(t==NULL){
//                cout<<"aaa"<<endl;
                return;}
                cout<<t->data<<endl;
                Preorder(t->left);
                Preorder(t->right);
        }
void BTree::Inorder(BTreeNode * t)
{
        stack <BTreeNode *> s;
        BTreeNode * p=t;
        while(1)
        {
                   while(p!=NULL)
                {
                          s.push(p);//不完整
                          p=p->GetLeft();
                }
                if(s.empty())
                          return;
                else
                {
                         p=s.pop();
                         cout<<p->data;
                         p=p->GetRight();
                }
        }
}
void BTree:ostorder(BTreeNode * t)
{
    stack <NodeInt> s;
        s.push(NodeInt(t,1));
        while(!s.StackEmpty())
        {
        NodeInt N;
                N=s.pop();
                if(N.btr!=NULL)
                {
                        if(N.a==1)
                        {
                                s.push(NodeInt(N.btr,2));
                                s.puh(NodeInt(N.btr->left,1));
                        }
                        if(N.a==2)
                        {
                s.push(NodeInt(N.btr,3));
                                s.puh(NodeInt(N.btr->right,1));
                        }
                        if(N.a==3)
                        {
                                cout<<N.btr->data<<endl;
                        }
                }
        }
}
void BTree::creattree(BTreeNode * & toor)
{
        int data,lflag,rflag;
        char item;
        cout<<"please the data of the bintreenode:"<<endl;
        cin>>data;
        toor=new BTreeNode(data);
        cout<<"input the flag,if"<<stop<<"is input,stop the data inputing!"<<endl;
        cin>>item;
        if(item!=stop)
        {
                cout<<"if current node has leftchild,input 1,or 0"<<endl;
                cin>>lflag;
        if(lflag==1)
         creattree(toor->left);
                cout<<"if current node has rightchild,input 1,or 0"<<endl;
                cin>>rflag;
        if(rflag==1)
             creattree(toor->right);
        }
}
报错: error C2065: 'cout' : undeclared identifier

论坛徽章:
0
2 [报告]
发表于 2009-04-24 02:19 |只看该作者
……
using namespace std;

论坛徽章:
0
3 [报告]
发表于 2009-04-24 10:33 |只看该作者
2楼正解~~~
帖子标题呵~~~~
文不对题。。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP