postorder program

good day! i'm here again asking for your help. We're making a program for postorder but don't know how. Do you have codes for here? I'm using the old version of c++. Turboc++ with the blue screen. Thank you very much in advance. :] Actually it is due on monday. so i'm in a rush. please help. Thank you. >.<
thank you. i now have a program that convert the nodes to preorder,inorder, and postorder. Another problem has been made. We need to use randomize and the random numbers that was given should be the one that is to convert. i already has the code but i can't make it the way i need it to be. i need help. pls. :]]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include<stdio.h>                            // including headerfiles
#include<conio.h>
#include<stdlib.h>
#include<time.h>
#include<iostream.h>
struct jart                                  //creating structure
{
    int dataface;                                //data field of node
    struct jart *left,*right;             //left child & right child of node
};
struct jart *insert(struct jart *head,int shoulder);    //function for insertion
void post(struct jart *head);                 //function for postorder traversal
void in(struct jart *head);                // function for inorder traversal
void pre(struct jart *head);               // function for preorder traversal

int main(void)                                   //main function
{
clrscr();
 int i;

randomize();


    int a,b,c;
    struct jart *ruth;
    clrscr();
    ruth=NULL;

    cout<<"Fifthteen random numbers from 0 to 99\n\n";
	for(i=0; i<15; i++)
    cout<< rand() % 100<<" ";


	    cout<<"\nThe inorder traversal is \n";
	    in(ruth);                        //function calling
     
	    cout<<"\nThe preorder traversal is\n";
	    pre(ruth);                           //function calling
   
	    cout<<"\nThe postorder traversal is\n";
	    post(ruth);                            // function calling
    
    getch();
    return 0;
}

//function definition for insertion
struct jart *insert(struct jart *head,int shoulder)
{
    static struct jart *tn,*jn;
    if(head==NULL)
    {
	head=(struct jart *)malloc(sizeof(struct jart));
	head->dataface=shoulder;
	head->left=head->right=NULL;
    }
    else
    {
	tn=head;
	while(tn!=NULL)
	{
	    jn=tn;
	    if(shoulder<tn->dataface)
		tn=tn->left;
	    else
		tn=tn->right;
	}
	if(jn->dataface>shoulder)
	{
	    jn->left=(struct jart *)malloc(sizeof(struct jart));
	    jn=jn->left;
	    jn->dataface=shoulder;
	    jn->left=jn->right=NULL;
	}
	else
	{
	    jn->right=(struct jart *)malloc(sizeof(struct jart));
	    jn=jn->right;
	    jn->dataface=shoulder;
	    jn->left=jn->right=NULL;
	}
    }
    return head;
}
//function definition for inorder traversal

void in(struct jart *head)
{
    if(head!=NULL)
    {
	in(head->left);
	cout<<head->dataface<<" ";
	in(head->right);
    }
}

//function definition for preorder traversal
void pre(struct jart *head)
{
    if(head!=NULL)
    {
	cout<<head->dataface<<" ";
	pre(head->left);
	pre(head->right);
    }
}

//function definition for postorder traversal
void post(struct jart *head)
{
    if(head!=NULL)
    {
	post(head->left);
	post(head->right);
	cout<<head->dataface<<" ";
    }
}


that would be my code. it's already running yet i couldnt convert the random numbers given.
Topic archived. No new replies allowed.