Program 4 Ė Integer Binary Tree
Due: Midnight Monday July 19

The following program sets a binary three with 7 nodes.  In this version of the program the node values are fixed.  You are required to make modifications such that it reads values (we donít know how many) from an input file as a set of integers separated by a blank space then display the tree.  The three should be sorted, thus the values should be listed from larger to smaller top to bottom and left to right at each level.  An example output (note this will be flipped 900 counter clockwise when you run the program):
                         80
                70              60
        50              40          30

You can copy the following file from the web page of the course. I have used bintree.h.  Note: The output of the program is flipped by 90 degree counter clockwise.
// FILE: mytree.C
//This program used the binary tree toolkit to create an integer tree.
#include <cstdlib>     // Provides EXIT_SUCCESS
#include <iostream>    // Provides cout
#include "bintree.h"   // Provides the binary tree node functions
using namespace std;
using namespace main_savitch_10;

binary_tree_node<int>* beginning_tree( );
// Postcondition: The function has created a small integer tree. The return
// value is the root pointer of the new tree.

int main( )
{
    binary_tree_node<int> *taxonomy_root_ptr;
    int size;
 
    taxonomy_root_ptr = beginning_tree( );
    size = tree_size(taxonomy_root_ptr );
    print(taxonomy_root_ptr,size);
    return EXIT_SUCCESS;
}

binary_tree_node<int>* beginning_tree( )
{
    binary_tree_node<int> *root_ptr;
    binary_tree_node<int> *child_ptr;
    const int root_value = 30;
    const int left_value = 10;
    const int right_value = 40;
 
    root_ptr = new binary_tree_node<int>(root_value);

    // Create the root node
    child_ptr = new binary_tree_node<int> (left_value);
    child_ptr->set_left( new binary_tree_node<int>(70));
    child_ptr->set_right( new binary_tree_node<int>(50));
    root_ptr->set_left(child_ptr);

    // Create and attach the left subtree.
    child_ptr = new binary_tree_node<int>(right_value);
    child_ptr->set_left( new binary_tree_node<int>(19) );
    child_ptr->set_right( new binary_tree_node<int>(49) );
    root_ptr->set_right(child_ptr);
    return root_ptr;
}

Exact output of the above program:
./a.out
                                    49
                        40
                                    19
                30
                                    50
                        10
                                    70
Note once agian that the root of the tree is 30 and the three is going frm left to right instead of top bottom.