So it seems to me it would return true if niether of those flags are checked. It works for me and is a technique I use when I write. Like I said, though your code is cleaner and would return true if the input was a success.
EDIT: I didn't like my "tone" so I changed a few things.
class NodeTree
{
private:
int LineNumber;
int count;
int runs; //what for?
ifstream inFile; //Too much coupling. And it is unnecessary
node *root;
public:
NodeTree(); /*This is our constuctor*/
~NodeTree(); //You will need a destructor, and a way to manage copy/assignment
// node mynode;
/*I don't like making members public but this makes it easier to plug into your code */
node* Insert(node*, float); //why do you need to pass the node?
node* Insert(float);
float minValue();
float maxValue();
I passed the node in Insert() because the prototypes on the NodeTree class were basically copy\pastes of the OP's existing code. I thought it would make it easier to understand if he didn't know how Classes worked. EDIT: And it now occurs to me that we are using a Class to avoid that kind of crap *facepalm*
There should only be one NodeTree in existance so aren't the destuctor and copy\assign redundent? I could see where teaching that stuff from the beginning would be helpful but I'm also concerned about scaring the OP away.
Why did we make mynode\*root private? I like it better that way to but not for any reasons that come up in this code.
In this assignment there is just one tree.
However, I think you are right. Those are thinks that could be delayed to after NodeTree::erase be implemented. (maybe tomorrow)
The root is private so it can't be used from outside. That way the programmer it is forced to use the methods, and doesn't have to worry about the implementation of the class. (loose coupling)
Thank you for trying to help me with this. Talking about classes we used these in the last assignment for a 2d array. The following code was used to define that:
struct ipair {
int key;
int other_stuff;
};
class table_of_pairs {
int table_size;
ipair *ptable;
int num_in_table;
public:
table_of_pairs(constint size) {
num_in_table = 0;
ptable = new ipair[(table_size = size)+1];
// Set up an array of the requested size
};
~table_of_pairs() {delete [] ptable;};
int add_to_table(constint, constint);
int number_in() const {return(num_in_table);};
void print_table() const;
};
I was going to use this again to pass the ordered results into.
The more im doing this the more i'm thinking it would just be easier to pass the numbers from the .txt file into an array then just do a mergesort/heapsort etc and just read the numbers off that way.