hi everyone, i have an error while i compile this code. i tried two diff code but same error...as i know that void function canot return value.. so anyone can help me to fix and return the count number please///
Code:
void IPlist::updateCount(string address)
// precondition : address is in list
// postcondition : the count of node with address has been incremented
{
node* currPtr = list;
int TotalCount = 0;
do
{
TotalCount++;
currPtr = currPtr->link;
}while (currPtr != list);
return TotalCount;
}
Code:
void IPlist::updateCount(string address)
// precondition : address is in list
// postcondition : the count of node with address has been incremented
{
int count = 0;
node *tmp = list;
while(tmp != NULL && tmp->IPaddress == address)
{
count++;
tmp = tmp->link;
}
return count;
}