I have modified my code to declare the struct as a class instead.
so now I have:
class AvlNode
{
int element;
AvlNode *left;
Type: Posts; User: Bnchs400
I have modified my code to declare the struct as a class instead.
so now I have:
class AvlNode
{
int element;
AvlNode *left;
Yes, I see the problem now. Would this work if I just put the things in the struct in the public section of the AVL_Tree class and not use the struct so that I can create nodes from the class?
Yes, that's right. And perhaps I am doing this wrong. Is it possible to declare the AvlNode struct as if it were another class and then allow the AVL_Tree class access to the AvlNode?
I am trying to implement an AVL tree and have come up with the following code.
However, when I try the following, I get an error saying that AvlNode is undeclared.
int main()
{
AVL_Tree...
I am trying to find out how much time it takes to complete an execution of a program in Linux, by executing it from a new process. I am using the <time.h> time() function, but I get strange numbers...
I am writing a simple calculator using GTK and one of the buttons is clear, which is supposed to do just that. I am using strings to get the numbers and also to display the result.
I've really only programmed with C++ and not C so far, and can't find out how to clear a string in C. I have tired using clear() and erase() but get the following error message:
"error: request for...
I downloaded the executable from sourceforge and I installed it to my main hard drive ie(C:\MinGW), adding C:\MinGW\bin to the PATH environment variable. The Dev-C++ I subsequently downloaded was the...
I have GTK and MSYS installed under Windows Vista. When I try to compile a c program using GTK libraries, I get the following error message:
gcc.exe: installation problem, cannot exec `cc1': No...
I broke up my program into an implementation file, a header file and a client source code file. I am using Dev-C++ and am having trouble getting the project file to link everthing and build the...
I now realize that I was using the stringstream improperly and found that this was the cause of a major problem. Now I know and have learned that the variables in the if () conditions just accept a...
If you read my original post, I have edited it to show the solution I have come up with. I have been able to devise an algorithm to multiply two polynomials through the iteration and I have traced...
Thanks, that did it.
Here is the loop:
int poly, argument, coefficient, exponent;
char colon = ':';
char assignment = '=';
char multiply = '*';
while(INPUTFILE && INPUTFILE.peek() != EOF)
Assuming the line is :
show 0
I expect the program to enter this block because the istringstream did indeed contain a line containing show and some integer. But it does not enter that block of...
I am confused now because I have a line like:
2 : 3 2 1 0
and a char object called colon assigned with ':'
when I test the following block of code, everything works as I think...
I have a question about istringstream. My inputfile has a line like:
show 2
and I have a string s and I assign it the string "show". I also have an int poly.
shouldn't this statement work?
Oh yes. But I did that to test to see If I could determine what was being executed and what was not. I even tried while (size >0) and for some reason, the for loops are not being executed.
I am trying to iterate through two list objects representing polynomials to perform a multiplication operation. But I have been unable to fix the problem with the while loop because it never enters...
I am trying to overload the * operator to multiply two objects of my class. Since it is a binary operator I know that the function should take a LHS and a RHS parameter. However, when I try the...
Well this is just the file processing part of a larger program. I have gone through several different options for extracting data from the input file and have settled with using string streams since...
I have spent some time reading about string stream but I have not been able to figure out how to use it to remove internal whitespace within a string. Can it indeed remove internal whitespace? Thanks.
I am now trying to use a sstream object instead to tokenize the string since the input file is delimited by whitespace. I am putting the tokens into a buffer and then pushing them onto a vector of...
Thanks, it works to copy the string from theTerms to s, but will it also work with the strtok() function, which is the primary reason why I am trying to do this?
I am trying to assign the array of char s the string read from a file, but I get "initializer fails to determine size of s", "invalid initializer" I found an earlier post on the forum where someone...