Type: Posts; User:
operator + is better written as a nonmember which kicks down to the member operator +=. For a full discussion on why some operators are better written as nonmenbers read this.
That is a 'template typedef'. Up until C++0x they didn't exist, and I am not sure if they exist in C++0x either. They can be simulated somewhat, details here and here.
Nope. Not wierd at all. Learn to use your debugger. Use your debugger.
Most bugs dont cause the compiler to spit out an error. Most occur during runtime. For this you need to attach the debugger and step through your code watching the variables closely as i have already...
Are all the cuboids filled to capacity with water?
If so surely its just adding up the volume of each of the specific cuboids with the volume of each cuboid being given by the formula length * width...
1. ArrayQueue - There is no direct C++ version but you can get close by using std::queue<T> which is based around a deque.
2. ListQueue - Use std::queue< T, std::list<T> > - queue using a doubly...
IDE's have nothing to do with text processing, I just answered your 'what is codeblocks' question.
For text processing, what do you want to do?
Its already been answered. What is wrong with the...
No. Its an IDE, an integrated development environment. Generally these consist of a code editor, a build system, a debugger, a compiler and a linker. See here.
Use your debugger and find out. Learning to debug your code is part of learning to program. work out on pen and paper what values you expect in variables and watch to see whats actually happening as...
fscanf( file, .............. )
how hard can it be. you open the file but never read from it. You have to tell the fscanf where to read from.
btw you will also need to drop the asterix here
as ncircles is a global int, not an int* so dereferencing it is completely wrong.
Give up programming its not for you!
if (( file = fopen( filename, "r" )) == NULL )
Ever going to do anything in particular with that open file pointed to by the FILE* called...
For starters change it to
void ReadFile( const char* filename )
change the call to ReadFile in main to only pass the filename.
change the scanf's to fscanf's with the FILE* as the first...
the variables you pass into the function are all GLOBAL. that means they can be accessed from everywhere. The only parameter that function needs is the filename. fscanf is slightly different to...
In ReadFile you should be reading from a file not from the keyboard. Surely those scanf's should be fscanf's. Also drop the ncircles parameter completely as that variable is global as are s and t...
My god, this is C++ not BASIC. Remove those gotos and replace them with loops and conditionals.
C++ supports 3 types of loop, they are counted (for loop), top tested (while loop ) and bottom tested...
Personally I think that STL use should be taught before dynamic allocation. Of course you need to learn both but why start with the more low level concept. Should we all learn asm before C++? No, of...
I think code like this could be a problem. free wont call destructors and replacing it with delete wont work as realloc will not do new's bookkeeping. Could lead to resource leaks if the type...
insert_node is expecting a pointer, you pass it an object. pass its address instead by prefixing it with & like so
blank.insert_node(&blank, blank.key_value, blank.item_value);
atoi expects a const char* and you are giving it a std::string. change
else blank.item_value.id = atoi(str);
else blank.item_value.id = atoi(str.c_str());
why are you templating create_database in studentRecord?
Its not necessary.
should just be
bst<studentRecord, int>* create_database();
Also on another note why is student_record.h header...
post a small but complete example that exhibits the problem (inside code tags). Try to cut down your code to just the bare essentials, dont dump the lot on us.
Click Here to Expand Forum to Full Width