Why this code is not giving output ??
#include
#include
using namespace std;
class node
{
public:
string data;
nodeleft;
noderight;
node(string d)
{
data=d;
left=NULL;
right=NULL;
}
};
node *buildtree()
{
string d;
cin>>d;
if (d=="false")
{
return NULL;
}
node *root=new node(d);
root->left=buildtree();
root->right=buildtree();
return root;
}
bool check(node *root1, node *root2)
{
if (root1==NULL && root2==NULL)
{
return true;
}
if (root1!=NULL && root2!=NULL)
{
bool la=check(root1->left,root2->left);
bool ra=check(root1->right,root2->right);
return la && ra;
}
return false;
}
int main()
{
node *root1=buildtree();
node *root2=buildtree();
bool ans;
ans=check(root1,root2);
cout<<ans;
return 0;
}