What is destructor example?
1013
Plese get me a perfect C++ program for railway/airway
reservation with all details.
3861
What is advantage of inheritance?
1155
Is data hiding and abstraction same?
982
when to use 'mutable' keyword and when to use 'const cast'
in c++
2130
What is difference between abstraction and encapsulation?
1046
What is difference between multiple inheritance and multilevel inheritance?
1121
What is the difference between encapsulation and polymorphism?
1069
Why polymorphism is used in oops?
1023
why reinterpret cast is considered dangerous?
2355
What exactly is polymorphism?
1096
What is the difference between procedural programming and oops?
1094
#include
#include
#include
#include
void insert(struct btreenode **, int);
void inorder(struct btreenode *);
struct btreenode
{
struct btreenode *leftchild;
struct btreenode *rightchild;
int data;
};
main()
{
struct btreenode *bt;
bt=(struct btreenode *)NULL;
int req,i=1,num;
clrscr();
printf("Enter number of nodes");
scanf("%d",&req);
while(i<=req)
{
printf("Enter element");
scanf("%d",&num);
insert(&bt,num);
i++;
}
inorder(bt);
}
void insert(struct btreenode **sr, int num)
{
if(*sr==NULL)
{
*sr=(struct btreenode *)malloc (sizeof(struct btreenode));
(*sr)->leftchild=(struct btreenode *)NULL;
(*sr)->rightchild=(struct btreenode *)NULL;
(*sr)->data=num;
return;
}
else
{
if(num < (*sr)->data)
insert(&(*sr)->leftchild,num);
else
insert(&(*sr)->rightchild,num);
}
return;
}
void inorder(struct btreenode *sr)
{
if(sr!=(struct btreenode *)NULL)
{
inorder(sr->leftchild);
printf("\n %d",sr->data);
inorder(sr->rightchild);
}
else
return;
}
please Modify the given program and add two methods for post
order and pre order traversals.
3721
What is byval and byref? What are differences between them?
2179
how to get the oracle certification? send me the answer
2133