Can anyone see what is wrong with this function the returns the height of a binary tree
int op::tree_height(const BNODE *mt)
{
if(mt == NULL) return 0;
int left = 0;
Type: Posts; User: noodle24
Can anyone see what is wrong with this function the returns the height of a binary tree
int op::tree_height(const BNODE *mt)
{
if(mt == NULL) return 0;
int left = 0;
All I need is a simple function that will return the height of the tree. Can someone please tell me what's wrong with this code...
int bt::tree_height(const node *mytree)
{
if(mytree ==...
I am trying to print out is ascending order instead of descending order. Here is my code
Here is some sample output
How many boxes do you see? 4
Now opening box .4
Now opening box .4.3
Now...
I want to update a data file. If a == target then I want it to ignore a b and c and then print the rest of the file to the same file.
Here is my code
void list(string target)
{
string...
Yes that was just a typo. I have tried ios::app
Here is what I have tried...
string newdata;
ofstream fout ("data.txt", ios:app);
fout << newdata;
When I do this though, it erases everything that was already in it.
I already have a list of stuff in my data.txt file.
How do I add stuff to that data.txt file without erasing what's already in it?
Thanks in advance
I'm kind of a newbie and I've been searching through my book and can't figure out how to do it.
I have a bunch of names in a data file. One name, first and last, per line.
How can I open up the file, read them, and then print them to the screen?
Here is the top of my class
template < class T >
class TODLLNode
{
friend class TODLList;
I want to print out all 3744 possible poker full houses. Right now I am just assigning cards to be numbers. I'll deal with that later. But here is what I have so far and I'm just getting bad data.
...
OK what if I didn't want to print them out but I just wanted to go through every possible hand and then do something with it later.
How would I go about printing every possible 5 card poker hand. I know I need a few for loops but I don't understand how I would go about doing it. Thanks in advance!
I read the website given and I still can't figure it out.
I have an array int arr[10];
I want to fill the array up with random numbers between
int low = 5;
int high = 15;
How would I do this? From what I know, I think I need the <cstdlib> and I...
I'm having a hard time understanding what you are saying and putting that into code.
So say my private variables are
num // # of elements in the array
cap // size of the vector
T * data // the dynamic array
should I do something like
T * temp = new T[cap];
I am supposed to implement the void pop_back (); function from the vector class for a project. Does anybody know how to implement this function that removes the last element from the Vect.
I cant figure out why I continue to get a core dump with this function. I'm trying to print out the numbers 3, 5, 7, 9, 11, 13
_num, field_size, and num_per_line are all equal to 6 when I call the...
I don't know how to put what you said into code. I'm kind of a newbie.
I have the following constructor
Vector ( T fill [ ], int size)
{
// don't know what goes here
}
My private variable are
You're the man. Thanks!!
I have seen all the other threads but I can't get mine to work. I am trying to multiply two matrices with overloading operators.
mat[SIZE][SIZE] is my private variable
SIZE is initalized to 2 for...
I have a matrix and I need to be able to print out all of its contents. Right now I have it such that const int size = 2;
And then my matrix is matrix[size][size];
It needs to work of course so...
I'm new to programming. What is the difference between a while and do while loop?