do you mean in the default constructor??
do you mean in the default constructor??
I mean count should be set to 1 not 0 at the beggining - this will fix your output to
IP address count
034.056.078.012 1
100.001.004.031 2
111.022.033.004 3
192.149.089.061 5
I suppose the 192.149.089.061 was the first ip entered.
look at my comment about missing else - this will fix 5 to 4
I mean here:do you mean in the default constructor??
Code:void IPlist::insertInOrder(string address) // precondition : list is ordered and address is not in list // postcondition : list is ordered and contains address { node *tmp = new node; tmp->IPaddress = address; tmp->count=1;...
Last edited by vart; 10-27-2006 at 09:53 AM.
yes the overall output is correct but the last ip address suppose to be 4//...Originally Posted by vart
i mean count 4 instead of 5
wat do you mean by this vart
I suppose the 192.149.089.061 was the first ip entered.
look at my comment about missing else - this will fix 5 to 4
read my comment #28 in this thread
>>yes the overall output is correct but the last ip address suppose to be 4//...
i mean count 4 instead of 5
This type of problem frequently occurs because of the wrong condition used in a loop to read in the file. If you have something like this:
while(! ifstreamName.eof())
instead of something like
while (ifstreamName >> variableName)
or this
while(ifstreamName.getline())
then you get the innappropriate result because the last item from the file can behave as if it were being read in twice. Posting the code that uses a loop to read the file would be helpful if this post doesn't help you check it on your own.
You're only born perfect.