Good point! This worked:
string s;
s = point_type;
return s;
I have a separate toString function which does the following:
Type: Posts; User: abrownin
Good point! This worked:
string s;
s = point_type;
return s;
I have a separate toString function which does the following:
I managed to solve the problem by replacing
stringstream ss;
string s;
ss << point_type;
ss >> s;
return s;
Haha I get them all the time, I love programming :rolleyes:
Correction: it ignores ALL whitespaces. Not just leading ones.
My mistake: getline does NOT ignore leading whitespaces. I checked the binary tree I was reading chars into and it was the correct length. But, it doesn't PRINT spaces.
I'll post the printing code...
Hi All,
I am trying to read in lines in a text file, and the leading whitespaces are important! However the getline function isn't reading in the leading whitespaces. Is this a normal way for...
I solved it! Took me a lot of staring, but it was because every time I added a row I didn't add a new row object.. I was adding the SAME object.
So modifying the "row number" (or y variable)...
Hi grumpy thanks for your advice - I have since shortened my original post, but I really can't figure out this problem. I know it has to do with these overloaded operators not working correctly, but...
Hi All,
I am getting the following error regarding inserting items into a bintree:
terminate called after throwing an instance of 'std::invalid_argument'
what(): dataItem already in...
Thanks tabstop I'll give it a go tonight if I get a chance and post an update
Thanks hk_, I'll take your advice and implement it, it makes a lot of sense and I agree is much safer.
tabstop, regarding the following code:
template <>
void binnode<mazePoint>::print()
...
grumpy, you have totally just solved that part of my problem. It just had to be one of those silly errors, I'd put mazePoint:: too early! It was meant to say:
string mazePoint::toString()...
I'm afraid I get the exact same error EVOEx, I can't for the life of me figure out why..
If toString was an unknown member though wouldn't the compiler have a problem with it just being mentioned...
If you look at my cpp code you'll see I commented out a prototype for toString, and the function is included just before the last function (load_maze). So, I uncommented them and am receiving this...
Hi All,
This was in another thread but it's a completely new problem so I thought I'd create a new thread...
I am writing a program for an assignment which uses binary trees to store a text...
Thanks tabstop, that totally worked, now I'm working on being able to print the "maze". I've been struggling with it all night, but I'm receiving this error:
binnode.h: In member function...
Oh wow I'm such a dunce - thanks heaps, I'll try it when I get home and update with the result!
Thanks tabstop, I'll keep that in mind. I wonder if you could also help me with the error I'm experiencing?
Hi,
Thanks for advice! I think I successfully overloaded the operators, so it can compile. However, running the code produces the following error:
terminate called after throwing an...
Hi All,
I am writing a program for an assignment which uses binary trees to store a text file (a kind of maze):
1) Create a maze object which contains a binary tree of rows
2) Create a row...
Thanks!
Thanks for your quick response laserlight.
Hi All,
I've written a program for an assignment which utilises doubly-linked lists using the STL.
I create a class like so:
class row
{
private:
Thanks for the suggestions guys - I ended up doing it quite a slow way, without needing to define my own list. To be honest I'm simply not up to that level yet, I've had a bit of Java experience but...
Hi All,
I have a list of a class "row" - which contains a list of chars.
I have a static variable "TOTAL_ROWS" for the row class in my code which I want to update every time I add a new row to my...