![]() |
| ||
| Re: searching and inserting node in a binary search tree Please I'm new to this forum and I need a help with my code.I have written it all and compiled but it doesnt seem to bring any output(I'm reading the input from a file on my system).Please bail me out, I need to turn it in soonest #include<iostream> |
| ||
| Re: searching and inserting node in a binary search tree I'm sorry, I forgot to include that it is a phonebook and implemented in a singly linked list |
| ||
| Re: No output What does your input file contain? The program looks OK to me. However, it can not print anything if it does not have input file. lolz! |
| ||
| Re: No output First, how does it compile without the <string> library included? Once that's fixed, it does output, to the file, as you designed the program to do. Your input, however, will not be correct, using the infile >> inputNode.lastName >> inputNode.firstName >> .... method. This gets one "word" at a time for each input, so street address and possibly city names will be broken up. If the input file is formatted one field per line (first name, last name, street address, etc), then you can use getline( ).Once data is read in, you call many list functions. The program is mysteriously waiting for you to press a key to continue, with no indication that you must. It does seem to do what it's supposed to do. Also, the line else if ((i %3) == 3) will never be true. What is the range of possible responses from the mod operator?(added) You may be experiencing a hanging program with the input loop control you use: while (!infile.eof())eof will not be detected until you try to read after the last successful input, so input will hang, thus not completing the loop. Put the whole input line as the while( ) condition, and you should see something better occuring. while (infile >> inputNode.lastName >> .........) |
| All times are GMT -4. The time now is 12:59 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC