I tried child_ptr = new binary_tree_node(entry, target, NULL, NULL); but it did not help. I still get left2->leaf() and right2->leaf() false. They are suppose to be true. I don't see where the...
Type: Posts; User: jk1998
I tried child_ptr = new binary_tree_node(entry, target, NULL, NULL); but it did not help. I still get left2->leaf() and right2->leaf() false. They are suppose to be true. I don't see where the...
Sorry here it is
binary_tree_node::binary_tree_node(const string& init_data, const unsigned int& init_index, binary_tree_node* init_left, binary_tree_node* init_right)
{
...
After replaced root_ptr->set_left(child_ptr) with cursor->set_left(child_ptr) and root_ptr->set_right(child_ptr) with cursor->set_right(child_ptr), I am able to generate
___________________root_ptr...
Generating new nodes at the end is all I needed. Thanks
I am writing a insert function that will insert nodes into the binary tree according to their index. For example, if the tree is NULL, it will insert into the root_ptr, if the index is less than...
Thanks:)
I want the following function to open a file which the name of the file is stored in file_name. However, when I tried to compile it, I received no matching function for call to...
I am writing a binary taxonomy tree program that reads from an file and reconstruct the tree. The program will learn from the users and expand the tree.
The requirement is each node must contain an...
thanks :)
I created a stringstream but I don't know how to clear the memory.
Example
stringstream sstring;
int a = 12;
int b = 14;
sstring << a;
cout << sstring.str();
Thanks :)
Here I have a function that suppose search a stack and return the substring if found the match otherwise return Not exist. However, it somehow always return Not exist. I don't see why. Could...
thanks
I have the following function, when it is called, it printed out two sets of numbers 0x3d2468 and 0x3d2590. What are these numbers represent? What are they used for? Thanks in advance.
typedef...
I missed student_record in my makefile. Thanks anyway
I have three file impletment.cc , main.cc and student.h.
Here is my makefile
CC = g++
student_record: main.o impletment.o
$(CC) -o main.o impletment.o
Thanks
I know by writing this
ofstream school_file ("C:\\Student_data.txt") a file name Student_data.txt will store in C drive. But how do I store the file in the directory of the program run or current...
Thanks
I looked at the link. Why we needed the myflush() for the C++ implementation?
I know that using system("PAUSE") to pause a running program is bad. But I need it so that user can read the output. Is there any way to achieve the same effect of system("PAUSE") without using it?...
Thanks. I found a way around it.
I tried to substitute cin >> ans with the following function with ans=YorN(), but it is still doing the same thing. getline(cin, fx) still picks up the Enter key.
Please help.
char YorN()
{...
OK, I know why it goes to that else. Actually, it went into that else because user has to press Enter. The Enter triggered the getline(cin, fx), which then went to that else, not because of 'y'.
...
I found similar post from the forum, but I have another problem.
The code below I replaced ans=getch() with cin >> ans, but it fell into the next else(assuming user enter 'y') and printed. It was...