First of this code fragment will not even run with a regular C++ compiler.
Example:
int postorder(struct node *r)
{
int c=0;
if(r!=NULL)
{
i=preorder(r->left);
if(i!=0)
++c;
i=preorder(r->right);
if(i!=0)
++c;
r->count=c1+c2;
printf("\t %d \t %d",r->data,r->count);
}
}
Anyways I can give you some hints:
Follow these steps:
1.Open Visual Studio
2.Create new project.
3.Select the Visual c++ win32 console template. (From the create new project dialog in the left side choose visual c++ and then from the right side choose win32 console)
4.Type the name of your project/program.
5.You'll get a file opened with contents like this:
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
6.Remove everything from this except #include "stdafx.h"
7.Copy your whole code.
8.Next follow the next sequence of instructions given below.
After correcting the general programming errors you have to:
1.Use #include<malloc.h> for using the malloc function
2.For using clrscr(); use system("cls"); instead